/*

	função para substituir o alert PAM! do JS
 	Criado por Davi Ferreira
	Última modificação 25/08/2007

*/


// timer para o timeout do javascript
var msgTimer = '';

// tempo padrão para msgTopo
var tempoPadrao = 5000;

// função simples para exibir resposta de erro ou confirmação
var msgTopo = function(txt,classe,tempo) {
	// limpa timeout
	clearTimeout(msgTimer);
	// esconde selects
	$('select').each(function(){$(this).hide();});
	// exibe msg
	if (classe == 'erro') {
		$('#msg-topo').removeClass('msg');
	} else {
		$('#msg-topo').removeClass('erro');
	}
	$('#overlay').fadeIn();
	$('#overlay').click(hideMsgTopo);
	$('#msg-topo').addClass(classe);
	
	// hack para IE6 já que não aceita fixed...
	if ($.browser.msie == true && $.browser.version < 7) {
		$('#overlay').css('top', $(window).scrollTop());
		$('#msg-topo').css('top', $(window).scrollTop() + ($(window).height()/2) - 20);
	}
	
	$('#msg-topo').html('<ul>'+txt+'</ul><p style="text-align: center; padding-top: 7px"><a href="javascript:;" onclick="hideMsgTopo();" style="color:#000">click to close</a></p>');
	$('#msg-topo').fadeIn();
	msgTimer = setTimeout("$('#msg-topo').fadeOut();$('#overlay').hide();$('select').each(function(){$(this).show();});", tempo);	
}; // fim msgTopo

var hideMsgTopo = function() {
	clearTimeout(msgTimer);
	$('#overlay').fadeOut();
	$('#msg-topo').fadeOut();
	$('select').each(function(){$(this).show();});
};