
//Tenta criar o objeto xmlHTTP
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 to create a form
function createphoto(e, foto){
	theObject = document.getElementById("verfoto");
	theObject.style.visibility = "visible";
	theObject.style.height = "200px";
	theObject.style.width = "200px";
	var posx = 0;
	var posy = 0;
	posx = e.clientX + document.body.scrollLeft - 180;
	posy = e.clientY + document.body.scrollTop - 120;
	theObject.style.left = posx + "px";
	theObject.style.top = posy + "px";

	//The location we are loading the page into.
	var objID = "verfoto";
//	var serverPage = "theform.php";
	var obj = document.getElementById(objID);
	
	updateStatus('verfoto'); 
	
//	xmlhttp.open("GET", serverPage);
    xmlhttp.open("GET",foto);

	
//    xmlhttp.onreadystatechange=mostrafoto

	
	xmlhttp.onreadystatechange = function() {
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
		obj.innerHTML = xmlhttp.responseText;
	}
	} // close function
xmlhttp.send(null);
}



function updateStatus()
{
	//document.getElementById("errordiv").innerHTML = "";
	document.getElementById('verfoto').innerHTML = "<span class=claviso>  Carregando ...  </span>";
}




// funcao para foto

function foto(foto){
    //Abre a conexão
	updateStatus('verfoto'); 
	
    xmlhttp.open("GET",foto);
    xmlhttp.onreadystatechange=mostrafoto
    //Executa
    xmlhttp.send(null)
}

function mostrafoto() {
if (xmlhttp.readyState==4){
   //Mostra o HTML recebido
   document.getElementById('verfoto').innerHTML=xmlhttp.responseText
   }
}

// resgata e mostra dados

