// JavaScript Document
function criaAjax(){
	var ajax;
	try{
		ajax = new XMLHttpRequest();
	}catch(ee){
		try{
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				ajax = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				ajax = false;
			}
		}
	}
	return ajax;
}

function gE(idt){
	return document.getElementById(idt);
}
function gEs(iddt){
	return document.getElementsByTagName(iddt);
}
function rodaAjax(divCarregar, pagServidor){
}

function deletaFoto(idt, pg){
	xmlHttp = criaAjax();
	xmlHttp.onreadystatechange = function(){
		var mostra = gE(idt);
		if(xmlHttp.readyState == 1){
			mostra.innerHTML = "Deletando...";
		}else{
			if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
				resposta = xmlHttp.responseText;
				if(resposta == 'ok'){
					pre = mostra.firstChild;
					mostra.removeChild(pre);
					mostra.innerHTML = "";
					mostra.innerHTML = "Foto deletada";
				}else{
					mensagem = "Erro na deleção";
					mostra.insertBefore(mensagem, mostra.firstChild);
				}
			}
		}
	}
	xmlHttp.open("GET", pg, true);
	xmlHttp.send(null);
}