jQuery(function($) {
	$("ul.hijo").hide();
	$("ul li").hover(function() {
		$("ul",$(this)).show();
	}, function() {
		$("ul",$(this)).hide();
	});
	$("a[href]").click(function() {
		if (this.href.indexOf(location.hostname) == -1 || $(this).attr("rel")=="external") {
			abreVentana(this.href, "", "");
			return false;
		}
	});
	$("a.popup").click(function() { 
		abreVentana(this.href, '', 'width=960,height=550');
		return false;
	});
	$("a.popupPlano").click(function() { 
		abreVentana(this.href+',800', '', 'width=800,height=650,status=1,scrollbars=1');
		return false;
	});	
})

function abreVentana(direccion, nombre, param) {
	if (!(window.open(direccion, nombre, param))) {
		alert("No se ha podido abrir la nueva ventana. Por favor, habilite la apertura de ventanas emergentes en su navegador e inténtelo nuevamente.");
	}
	return false;
}