function loading(campo)
{
	var html = "<img src='img/loading.gif' />"	
	document.getElementById(campo).innerHTML = html;
}
<!-- ----------------------------------------------------- -->

<!-- ----------------------------------------------------- -->
function enviar_carrinho(id_produto)
{
		var url = 'php/carrinho_enviar.php';
		var pars = 'id=' + id_produto;
		var myAjax = new Ajax.Updater(
			'carrinho',
			url,
			{
				method: 'get',
				parameters: pars
			});
}
<!-- ----------------------------------------------------- -->
function somaitem(qtd, preco, divitem, chave)
{
	loading(divitem);
	
	var url = 'php/total_item.php';
	var pars = 'qtd=' + qtd + '&item=' + preco +'&id='+ divitem +'&c='+ chave ;
	var myAjax = new Ajax.Updater(
			divitem,
			url,
			{
				method: 'get',
				parameters: pars
			});
	
	atualizatotal();
}
<!-- ----------------------------------------------------- -->
/*function atualiza_carrinho(){
	alert('carregando valor');
	var url = 'php/carrinho_atualiza.php';
	var myAjax2 = new Ajax.Updater('carrinho', url);
	alert('retornou');
}*/
function atualiza_carrinho(){
	var url = 'php/carrinho_atualiza.php';
    var req = new Ajax.Request(
    url,{
            method: 'post',
            parameters: {dummy:new Date().getTime()},
            onSuccess: retornaQtdCompra
    });
}

function retornaQtdCompra(resp){
    document.getElementById('carrinho').innerHTML= resp.responseText;
}
<!-- ----------------------------------------------------- -->

function atualizatotal()
{
	loading('totalgeral');
	var url = 'php/atualiza_total.php';
	var myAjax = new Ajax.Updater('totalgeral', url);
}
<!-- ----------------------------------------------------- -->
function limpaChave(){
	if (document.getElementById('nome').value == 'Nome'){
		document.getElementById('nome').value = '';
	}
}
function voltaChave(){
	if (document.getElementById('nome').value == ''){
		document.getElementById('nome').value = 'Nome';
	}
}
function limpaChave2(){
	if (document.getElementById('email').value == 'E-mail'){
		document.getElementById('email').value = '';
	}
}
function voltaChave2(){
	if (document.getElementById('email').value == ''){
		document.getElementById('email').value = 'E-mail';
	}
}

function limpaChave3(){
	if (document.getElementById('usuario').value == 'login'){
		document.getElementById('usuario').value = '';
	}
}

function voltaChave3(){
	if (document.getElementById('usuario').value == ''){
		document.getElementById('usuario').value = 'login';
	}
}

function limpaChave4(){
	if (document.getElementById('senha').value == 'senha'){
		document.getElementById('senha').value = '';
	}
}

function voltaChave4(){
	if (document.getElementById('senha').value == ''){
		document.getElementById('senha').value = 'senha';
	}
}

function limpaChave5(){
	if (document.getElementById('buscar').value == 'por produtos'){
		document.getElementById('buscar').value = '';
	}
}

function voltaChave5(){
	if (document.getElementById('buscar').value == ''){
		document.getElementById('buscar').value = 'por produtos';
	}
}



function newsUp()
{
	var nome = document.getElementById('nome').value;
	var email = document.getElementById('email').value;
	if (nome == 'Nome')
	{
		document.getElementById('mensagem').innerHTML = 'Nome!';
	}
	else
	{		
			if ((email == 'E-mail') || ((email.indexOf("@") < 1) || (email.indexOf('.') < 4)))
			{	
				document.getElementById('mensagem').innerHTML = 'E-mail!';
			}else{	
				var url = 'php/news.php';
				var req = new Ajax.Request(
				url,{
						method: 'post',
						parameters: {nome:nome, email:email, dummy:new Date().getTime()},
						onSuccess: retornaMensagem
				});

								
			}
	}
}


function retornaMensagem(resp){
    document.getElementById('mensagem').innerHTML= resp.responseText;
	document.getElementById('nome').value = 'Nome';
	document.getElementById('email').value = 'E-mail';
}



