function ahah(url, target, type) {
	
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target, type);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target, type) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
	  $('#searching').fadeOut(200);
	  $('#results').fadeOut(400, function(){
     		responseIn(target, type);
										  });
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function responseIn(target, type){
	document.getElementById(target).innerHTML = req.responseText;
	if(!raised && type == "where"){
			$('#results').removeClass("low");
			$('#results').addClass("high");
			raised = true;
	}
	else if(raised && type != "where"){
			$('#results').removeClass("high");
			$('#results').addClass("low");
			raised = false;
	}
	$('#results').fadeIn(400);
}

function load(name, div, type) {
	ahah(name,div,type);
	return false;
}
