//<![CDATA[

/**
 * 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)
{
	$("#contenido a[href^=http]").not("a[href*=oicor.es]").not("a[href*=lacasadelabuelojusto.es]").addClass("external").attr("rel", "external");
	
	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],a.external").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 marcarSeccionActiva()
{
	var url = document.URL.substring(document.URL.lastIndexOf("/"));
	if (url == '/')
	{
		url = '/inicio';
	}
	
	$("#cabecera a[href*='" + url + "']").css({'color':'#000'}).removeAttr("href");
}

$(document).ready(
	function(e)
	{
		activarPopups(800,600);
		marcarSeccionActiva();
		Nifty("#cabecera ul");Nifty("#contenido", "bottom big");
		$("tbody tr:even").css("background-color", "#eee");
		$("#cabecera li:last").css({'border':'none'});
	}
);

//]]>
