
var cIndicarAmigo;

function indicarAmigo( valor, uri ) {
    http.open("GET", "ajax/indicarAmigo.php?email=" + valor+"&uri="+uri, true);

	http.onreadystatechange = handleHttpResponseIndicarAmigo;

	indicarAmigoBck();

	document.getElementById("fbia-conteudo").innerHTML = "<img src='img/layout/aguarde.gif' />";
	http.send(null);
}

function handleHttpResponseIndicarAmigo() {

  campo_text = document.getElementById("fbia-conteudo");

  if (http.readyState == 4) {

	x = http.responseText.split("|erro");
	if(x.length > 1) {
		alert("Campo Email não pode estar em branco");
		campo_text.innerHTML = this.cIndicarAmigo;
	} else {
	    campo_text.innerHTML = x[0];
	}
  }
}

function indicarAmigoBck() {
	x = document.getElementById("fbia-conteudo");
	this.cIndicarAmigo = x.innerHTML;
}


