Buenas noches, aqui en argentina es de noche.. :P
 
Necesito hacerles una consulta, tengo esta funcion:    
EDIT:
esto es lo que tengo antes del codigo que sigue:  
Código:
 function objetoAjax(){
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
		   xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
  		}
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}
  
Código:
 function cantidad_email_servidor(datos){
	ajax=objetoAjax();
	ajax.open("GET", datos);
	ajax.onreadystatechange=function() {
		if (ajax.readyState==4) {
                      //intente poner aqui un --> return ajax.ajax.responseText pero no me funciono
		}
	}
	ajax.send(null)
}
  luego tengo esto que quiero que se peuda hacer, osea que la variabel cantidad tome el valor que la 
funcion cantidad_email_servidor() devuelva:  
Código:
 cantidad = cantidad_email_servidor('consulta.php')
alert(cantidad)  //   <<--- CUANDO HAGO EL ALERT ME DA "undefined"
  Como puedo solucionar esto ? 
Gracias.