I know this is a PHP forum, but thought some of you may be able to offer help with the Javascript portion as well.
I'm running Ajax validation on a form I have, and the following is my javascript file. It runs fine, except for the statechangedFname portion. You can see its different from the other statechanged, as I added a nested if statement:
Code:
	  	  if (xmlhttp.status == 200) {
This is standard in Ajax, to see if the response is "ok." For some reason, the javascript stops reading once it gets to a nested if statement inside my functions! It doesn't matter if I have

Code:
var test=1
if (test==1) {
which is obviously true, it stops reading. If I have any code below (not in) the if statement, those are not read either.
I don't understand why, as it should work, correct?

The Javascript code is taken from a w3 demo, I edited it a bit to fit my needs.

Thanks!


Code:
// JavaScript Document
var xmlhttp;

function checkAjaxAlpha(str , id)
{
	str = encodeURIComponent(str);
if (str.length==0)
  {
	  //Check ID, output to correct Document ID
	  
	  if (id=="Fname") {
	document.getElementById("alpha_check_fname").innerHTML="";
	  }
	  if (id=="Lname") {
	document.getElementById("alpha_check_lname").innerHTML="";
	  }
	  if (id=="City") {
	document.getElementById("alpha_check_city").innerHTML="";
	  }
  	return;
  }
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
var url="../users/form_checks/alpha.php";
url=url+"?q="+str;
url=url+"&sid="+Math.random();

	  if (id=="Fname") {
		xmlhttp.onreadystatechange=stateChangedFname;
	  }
	  if (id=="Lname") {
		xmlhttp.onreadystatechange=stateChangedLname;
	  }
	  if (id=="City") {
		xmlhttp.onreadystatechange=stateChangedCity;
	  }
xmlhttp.open("GET",url,true);

xmlhttp.send(null);


}

function stateChangedFname()
{
if (xmlhttp.readyState==4)
  {
	  	  if (xmlhttp.status == 200) {
			  document.getElementById("alpha_check_fname").innerHTML=xmlhttp.responseText;
		  }
  }

}

function stateChangedLname()
{
if (xmlhttp.readyState==4)
  {
	  if(xmlHttpRequest.status==200){

  		document.getElementById("alpha_check_lname").innerHTML=xmlhttp.responseText;
	  }
  }
}

function stateChangedCity()
{
	if (xmlhttp.readyState==4)
  	{
		  document.getElementById("alpha_check_city").innerHTML=xmlhttp.responseText;
  	}
}


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}