//
//Maffo Advanced Locations Sytstem
//For use with 68Classifieds 4
//Written by Andy Mathieson 
//Email maffo@classified-software.co.uk
//Online manaual available at
//http://www.classified-software.co.uk
//
var xmlHttp
var display_child
function showChildren(parent_id,location_id,admin)
{
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
} 

if (parent_id=="none"){
location_id=location_id-1;
var reset_child = document.getElementById("child_2");
	reset_child.innerHTML = '<input name="city" type="text"  value="" size="30" />';
}

if (location_id==1){
var reset_child = document.getElementById("child_2");
	reset_child.innerHTML = '<input name="city" type="text"  value="" size="30" />'; 
}


display_child="child_"+location_id;document.getElementById("child_2").value="fuck you ";
if(admin=='a')
	{
		var url="../modules/maff_locations/localizer_dropdown.php";	  
	}
else{
  		var url="modules/maff_locations/localizer_dropdown.php";
}	

url=url+"?p="+parent_id+"&l="+location_id+"&u="+admin;
url=url+"&sid="+Math.random();
if(location_id<3){
	xmlHttp.onreadystatechange=stateChanged;
	xmlHttp.open("POST",url,true);
	xmlHttp.send(null);
	}
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById(display_child).innerHTML=xmlHttp.responseText;
}
}



function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}