/*
###############################################
## file...	
## desc...	
##
## date...	7/14/2008
## rev....	
###############################################
*/

function callAjax()
{
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
  {
 		if(xmlHttp.readyState==4)
   	{
   		var optionVals = eval(xmlHttp.responseText);
    	
			for(var i=0;i<optionVals.length;i++){
 				document.adv_search_frm.aCity.options[i]=new Option(optionVals[i], optionVals[i], false, false)
   			//document.getElementById('cityDiv').innerHTML=xmlHttp.responseText;
   		}
 		}
 	}
  
	/*xmlHttp.open("POST","getcity.php",true);
  xmlHttp.send("st="+document.getElementById('asState2').value);*/
  var tmp = "getcity.php?state=";
  tmp += document.getElementById('aState').value;
  xmlHttp.open('GET', tmp, true);
  xmlHttp.send('');
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}




function advAjax()
{
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    try
      {
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    catch (e)
      {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
  }
  xmlHttp.onreadystatechange=function()
  {
 		if(xmlHttp.readyState==4)
   	{
   		document.getElementById("load").innerHTML = "<h3>ADVANCED SEARCH FEATURE</h3><br /><hr/>";
			var optionVals = eval(xmlHttp.responseText);
			
			document.adv_search_frm.advLoc.options[0]=new Option('None', '', true);
   		for(var i=0;i<optionVals.length;i++){
				document.adv_search_frm.advLoc.options[i+1]=new Option(optionVals[i], optionVals[i], false, false);
   			//document.getElementById('cityDiv').innerHTML=xmlHttp.responseText;
   		}
 		}else{
			document.getElementById("load").innerHTML = "<h3>ADVANCED SEARCH FEATURE</h3><img src='http://www.lawyerfindnetwork.com/images/ajax-loader.gif' border='0' /><hr />";
		}
 	}
  
	/*xmlHttp.open("POST","getcity.php",true);
  xmlHttp.send("st="+document.getElementById('asState2').value);*/
  //check for county or city search
  var tmp;
	var advLoc;
  var loc = document.adv_search_frm.choice;
	for(var n = 0; n < 2; n++) {
		if(loc[n].checked) {
			advLoc = loc[n].value;
		}
	}
  if(advLoc == "city"){
		tmp = "getcity.php?loc=city&state=";
	}else{
  	tmp = "getcity.php?loc=county&state=";
  }
  tmp += document.getElementById('aState').value;
  xmlHttp.open('GET', tmp, true);
  xmlHttp.send('');
}