
$( function() {
	$('.external').click( function() {
		window.open($(this).attr('href'));
		return false;
	});
	$('.window').click( function() {
		var tipoventana = $(this).attr("rel");
		popup($(this).attr('href'),tipoventana);
		return false;
	});
	
});

$( function() {
	$(".button a").mouseover(function(){
			$(this).addClass("on")
		});
	$(".button a").mouseout(function(){
			$(this).removeClass("on")
		})
});

// abre un popup centrado
function popup(url,talla) {

	var aw = screen.availWidth - 10;
	var w; var h;

	switch (talla){
		case "talonario":
			w=720;
			h=610;
			break;
		default:
			w=630;
			h=550;
	}

	xc = (aw - w) / 2; // center

	features = 'status=no,scrollbars=yes,menubar=no,toolbar=no,location=no,directories=no,resizable=yes,copyhistory=no,width=' + w + ',height=' + h + ',' + 'left=' + xc	+ ',top=0,screenX=' + xc + ',screenY=0';
	
	var ventana = window.open(url, 'popup'+w, features);	
	if(ventana != undefined){
		ventana.focus();
		return true;
	}
	
	return false;
}

/*
 * Marcacion estadistica documentos
 */
$( function() {
	$('.tracker-document').click( function() {
		pageTracker._trackPageview($(this).attr('href'));
	});

	return true;
});