try{
	xmlhttp = new XMLHttpRequest();
}catch(ee){
	try{
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	}catch(e){
		try{
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		}catch(E){
			xmlhttp = false;
		}
	}
}	

function conteudo(pagina, div, comp){
	if(xmlhttp) {
		var conteudo = document.getElementById(div);
		conteudo.innerHTML = "<p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src='./imagens/loading_ajax.gif' align='center'>";
		xmlhttp.open("GET", pagina+".php?"+comp, true);
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4){
				if(xmlhttp.status == 200)
					conteudo.innerHTML = xmlhttp.responseText;
				else
					conteudo.innerHTML = "Ocorreu um erro: (" + xmlhttp.status + ")" + xmlhttp.statusText ;
			}
		} 
	}
	xmlhttp.send(null);
}


function del_img(id, codFoto) {
	if(xmlhttp) {
		var divdel = document.getElementById("divdel");
		var imgajax = document.getElementById("imagemAjax");
		var imgdel = document.getElementById("imagemAjax_delete");
		imgdel.src = "../images/loading2.gif";
		imgajax.style.display = "none";
		xmlhttp.open("GET", "apaga_foto.php?codItem="+id+"&codFoto="+codFoto, true);
		xmlhttp.onreadystatechange = function(){
			if (xmlhttp.readyState == 4){
				if(xmlhttp.status == 200){
					imgdel.style.display = "none";
					divdel.innerHTML = xmlhttp.responseText;
				}else
					divdel.innerHTML = "Ocorreu um erro: (" + xmlhttp.status + ")" + xmlhttp.statusText ;
			}
		} 
	}
	xmlhttp.send(null);
}
