function exibirLoading() {

	removerLoading();

	var mask    = $('<div id="mask-loading"></div>');
	var loading = $('<div id="img-loading"><img src="' + BASE_URL + 'resource/frontend/slices/_loading.gif" width="32" height="32" /></div>');

	mask.height($(document).height());

	mask.css({
		width: '100%',
		backgroundColor: '#ffffff',
		zIndex: '10000',
		position: 'absolute',
		top: 0,
		left: 0
	});

	mask.fadeTo(0, 0.8);

	loading.css({
		width: 31,
		heigth: 31,
		margin: '0 auto',
		zIndex: '10001',
		position: 'fixed'
	});

	loading.css('left', ($(window).width() - 31) / 2);
	loading.css('top', ($(window).height() - 31) / 2);

	$('body').append(mask);
	$('body').append(loading);
}

function removerLoading() {
	$('#mask-loading, #img-loading').remove();
}

$(function() {
	$(window).scroll(function() {
		var divisor = $(document).height() / $(window).height();
		var barra   = parseInt($(window).height() / divisor);

		var height = $(document).height() - barra;
		
		if (height > barra) {
		
			var scroll = $(document).scrollTop() + parseInt(barra / 2);
			var porc   = parseInt(height / 100) * 50;

			if (porc <= scroll) {
				$('#go-top').slideDown();
			} else {
				$('#go-top').slideUp();	
			}
		
		}
	});
	
	$('#go-top').click(function() {
		$('body, html').animate({
			scrollTop: $('#Topo').offset().top
		}, 1000);    
	});
});
