function popup(pagina,janela,w,h,rolagem,maxi) {
	
	lar = screen.width;
	alt = screen.height;
	
	if (maxi == '') maxi = 'no';
	if (rolagem == '') rolagem = 'no';
	
	var winDt = window.open(pagina,janela,'width='+w+',height='+h+',scrollbars='+rolagem+',toolbar=no,location=no,status=no,menubar=no,resizable='+maxi+',left='+((lar-w)/2)+',top='+((alt-h)/2)+'');
	
	winDt.focus();
	
}

function bloquearTela() {
	alt = ($('body').height() > document.documentElement.clientHeight)?$('body').height():document.documentElement.clientHeight;
	var configModal = {
		id      : 'divWaiting',
		width   : $('html').width(),
		height  : alt,
		classe  : 'modal-waiting'
	}
	$('body').loading(configModal);
}


function closeModal(modal) {
	closeWaiting = true;
	numModal     = 0;

	$('body .modal').each(
		function() {
			if ($(this).css('display') != 'none') {
				numModal++;
			}
		});
	if (numModal > 1) {
		closeWaiting = false;
	}

	/* se modal = lastModal, fecha modal */
	if ((modal == lastModal) || (lastModal == null) || ($('#'+lastModal).css('display') == 'none'))	{
		$('#' + modal).fadeOut('fast');
		lastModal = null;
	}

	if (closeWaiting == true) {
		$('#divWaiting').fadeOut('fast');
	} else {
		if ((jQuery.browser.msie === true) && (jQuery.browser.version < 7)) {
			$('#'+lastModal).stop().effect('highlight', {}, 1000);
		} else {
			$('#'+lastModal).stop().effect('bounce', {}, 50);
		}
	}
}
