// JavaScript Document

function limpacampo(){
		document.getElementById('email').value="";
	}
	
function InsCampo(){
		document.getElementById('email').value="digite seu e-mail";
	}
function limpaHelp(){
		document.getElementById('usuario').value="";
	}
	
function InsHelp(){
		document.getElementById('usuario').value="Usuario";
	}
	
function limpaSenha(){
		document.getElementById('senha').value="";
	}
	
function InsSenha(){
		document.getElementById('senha').value="senha";
	}

function sendMail(){
		var email = document.getElementById('email').value;
		http.open("GET","gravamail.php?email="+email,true);
		http.onreadystatechange=function(){
				if(http.readyState==4){
					if(http.responseText==1){
						alert('E-mail cadastrado com sucesso!');	
					}else{
						alert('E-mail ja cadastrado!');
					}
			}
				
			}
		http.send(null);	
	}


function apagafoto(foto){
		http.open("GET","delfoto.php?foto="+foto,true);
		http.onreadystatechange=muda;
		http.send(null);
	}
	
function muda(){
		if(http.readyState==4){
			var resp=http.responseText.split('|');
			document.getElementById('campo').style.display=resp[1];
			document.getElementById('foto').style.display=resp[0];
		}
	}

function getAjax(){
	ajax = null;
	try{
		ajax = new XMLHttpRequest();
		}catch(e){
			try{
				ajax = new ActiveXObject("Microsoft.XMLHttp");
			}catch(e){
				try{
					ajax = new ActiveXObject("MSXML2.XMLHttp");
				}catch(e){
					alert("Seu navegador não suporta Ajax");
				}
			}
	    }
	return ajax;
}

var http = getAjax();