
function jcarregaId(url,id){
		id='#'+id;
	
		$(id).fadeIn('slow').html("<img src=\"imagens/ajax-loader.gif\"/><font size=2 face=verdana> Carregando...</font>");
			$(id).load(url, function(response, status, xhr) {
					 if (status == "error") {
						var msg = "Erro ao carregar o conteúdo: ";
						$(id).fadeIn('slow', function() {
							$(id).html(msg + xhr.status + " " + xhr.statusText);
							});
						}
				});
			
		
};

 function carregaButtonSubmit(nome, texto, Nomecss){
			// Define aparência do botão
		
			$(nome).addClass(Nomecss);
			$(nome).html("<span class=\"le\"></span><center><div class=\"cc\">"+texto+"</div></center><span class=\"ld\"></span>");
		
			//Efeito quando passa o mouse
			$(nome).hover(function(){
				$(this).css('cursor','hand');
				});
	   }

 function carregaButton(nome, texto, url, Nomecss){
			// Define aparência do botão
		
			$(nome).addClass(Nomecss);
			$(nome).html("<span class=\"le\"></span><center><div class=\"cc\">"+texto+"</div></center><span class=\"ld\"></span>");
		
			//Efeito quando passa o mouse
			$(nome).hover(function(){
				$(this).css('cursor','hand');
				});
			
			
				
			// ao clicar...
			$(nome).click(function(event){
				$(nome+".div").html('Aguarde...')
				$(nome).fadeOut("slow");
				location.href=url;
				event.preventDefault();
			});
	   }
	  
	  function showResponse(responseText, statusText, xhr, $form)  { 
			alert('OCORREU UM ERRO.\nStatus: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\n erro:'+xhr); 
		} 

function carregaFormSubmit(botao, nomeForm, alvo, nomValidator) {
	
	if (nomValidator=="") { 	
		nomValidator="function(){}"; 
	}
	$(botao).click(function() {	
		$(nomeForm).submit();
	});
	
	//var alvo = "#resposta";
	
		var options = {
		clearForm: false,
		beforeSubmit: eval(nomValidator),
		target: alvo,
		success: function(resposta) {    
				$(alvo).html(resposta).fadeIn('slow');
			
			}
			,
		error: showResponse
		}
		
		
		$(nomeForm).submit(function() {	
			$(alvo).text("processando...").fadeIn('slow');
			$(this).ajaxSubmit(options);   
			return false;
		});
}
