///*** LINKS EXTERNOS ***///
/*
 *  quando precisar criar um link para ser aberto em uma nova janela, colocar no atributo
 * 	rel do link o valor 'externo'
 */
function createExternalLinks() {
	$("a[rel='externo']").attr("target","_blank");
	$("a[rel='externo']").attr("title",function () {
		this.title += " (abrirá em nova janela)";
	});
}


function posicionaSite() {
//	return;
	if ($(window).width() < $("#mestre").width()) {
		$("#mestre").css({
			'left' : '0',
			'margin-left' : '0'
		});
	}
	else {
		$("#mestre").css({
			'left' : '50%',
			'margin-left' : '-' + (parseInt($("#mestre").width())/2) + 'px'
		});
	}
	if ($(window).height() < $("#mestre").height()) {
		$("#mestre").css({
			'top' : '0',
			'margin-top' : '0'
		});
	}
	else {
		$("#mestre").css({
			'top' : '50%',
			'margin-top' : '-' + (parseInt($("#mestre").height())/2) + 'px'
		});
	}
}

// inicializa todas os eventos
function init() {
	createExternalLinks();
	posicionaSite();
	$(window).resize(posicionaSite);
}

$(document).ready(function() {
	init();

	$('.alert .fechar').click(function () {
		$(this).parent().remove();
		return false;
	});
});

