/**
 * @author usaelraton.com
 */
function marcarSeccionActiva() {
	var h = location.href;
	var url = h.substring(h.lastIndexOf("/") + 1);
	$("#menu a[href$=" + url + "]").css( {
		"background" : "none"
	}).wrap("<span></span>");
}

function marcarCasaActiva() {
	var h = location.href;
	var url = h.substring(h.lastIndexOf("/") + 1);
	$("#casas a[href$=" + url + "]").css( {
		"background" : "none",
		"color" : "#fff"
	});
}

$(function() {
	marcarSeccionActiva();
	marcarCasaActiva();
});

/**
 * Activa los pop-ups de los enlaces con rel="external", y centra los pop-ups en pantalla.  
 * @author usaelraton.com
 * @param {int} ancho
 * @param {int} alto
 */
function activarPopups(ancho, alto)
{
	if (ancho > screen.width) { ancho = screen.width;}
	if (alto > screen.height) { alto = screen.height;}
	var x = (screen.width - ancho) / 2;
	var y = ((screen.height - alto) / 2) - 30;
	$("a[rel=external],div#textos a").click(function(e) // Activamos el popup al hacer clic.
	{
		window.open(this.href, "Externo", "width=" + ancho + ",height=" + alto + ",left=" + x + ",top=" + y + ",resizable=yes,scrollbars=yes,toolbar=yes");
		return false;
	});

}

$(function(e)
		{
			activarPopups(800,600);
		}

	);

