var xmlHttp = new Array();
var url

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;
}

function stateChanged(id){
	if (xmlHttp[id].readyState<4){
		document.getElementById("localitati").innerHTML='<img src="images/loader-bar-blue.gif">';
	}
	if (xmlHttp[id].readyState==4){ 
		document.getElementById("localitati").innerHTML=xmlHttp[id].responseText;
	}
}

function stateChangedCateg(id){
	if (xmlHttp[id].readyState<4){
		document.getElementById("subcategorii").innerHTML='<img src="images/loader.gif">';
	}
	if (xmlHttp[id].readyState==4){ 
		document.getElementById("subcategorii").innerHTML=xmlHttp[id].responseText;
	}
}

function adauga_localitati(judet){

	xmlHttp[1]=GetXmlHttpObject(); 
	
	url="include/get-localitati.php";
	url=url+"?judet="+judet;
	
	xmlHttp[1].onreadystatechange=function () { stateChanged('1'); };
	xmlHttp[1].open("GET",url,true);
	xmlHttp[1].send(null);	
}

function admin_adauga_localitati(judet){

	xmlHttp[1]=GetXmlHttpObject(); 
	
	url="get-localitati-admin.php";
	url=url+"?judet="+judet;
	
	xmlHttp[1].onreadystatechange=function () { stateChanged('1'); };
	xmlHttp[1].open("GET",url,true);
	xmlHttp[1].send(null);
	
}

function getSubcategorii(categ, currentSubCateg){

	xmlHttp[1]=GetXmlHttpObject(); 
	
	url="get-subcategorii.php";
	url=url+"?categ="+categ+"&subcateg="+currentSubCateg;
	
	xmlHttp[1].onreadystatechange=function () { stateChangedCateg('1'); };
	xmlHttp[1].open("GET",url,true);
	xmlHttp[1].send(null);	
}