function ajaxInit() {
	var req;
		try {
			req = new ActiveXObject("Microsoft.XMLHTTP");
		} catch(e) {
		try {
			req = new ActiveXObject("Msxml2.XMLHTTP");
		} catch(ex) {
			try {
		req = new XMLHttpRequest();
			} catch(exc) {
	alert("Esse browser não tem recursos para uso do Ajax");
		req = null;
			}
		}
	}
	return req;
}

function atualizaImagem(marca,target){
		
		ajax = ajaxInit();
		ajax.open("GET", "atualiza_imagem.php?largura=500&marca="+marca, true);
		ajax.setRequestHeader('Content-type','application/x-www-form-urlencoded; charset=utf-8'); 
		ajax.setRequestHeader("Cache-Control", "no-store, no-cache, must-revalidate");
		ajax.setRequestHeader("Cache-Control", "post-check=0, pre-check=0");
		ajax.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); 
		ajax.setRequestHeader("Pragma", "no-cache");
		ajax.onreadystatechange=function() {
				if (ajax.readyState==1){				
					document.getElementById(target).innerHTML = '<div style="margin:0 auto; width:32px; height:32px; margin-top:120px;"><img src="imagens/loading.gif" /></div>';
				}
				if (ajax.readyState==4){
					document.getElementById(target).innerHTML = ajax.responseText;
				}
			}
		ajax.send(null);
}