function handleHttpResponse_oras() 
{  
  if (http.readyState == 4) {
    var  results = http.responseText.split(",");
	var nr = results.length;
	var start=0;
	DeleteAllOptions('cautare', 'loc2');
//	AddOption('cautare', 'loc2', '--selectati--', '0') ;
	Enable('cautare', 'loc2');	
	if (nr>2) {
		AddOption('cautare', 'loc2', '--selectati--', '0') ;
		start = 1;
	} 
	var obj =  document.getElementById('loc2');
		for (var i=0; i<nr; i+=2) {
		obj.options[i/2+start] = new Option(results[i+1],results[i]);
	}
 }
}

function updateLoc() {
  var idtara = document.getElementById('loc1').value;
  if (idtara!='0' && idtara!='00') {
	  http.open("GET", url + 'loc1='+escape(idtara), true);
	  http.onreadystatechange = handleHttpResponse_oras; 
  	  http.send(null);
  } else {
	DeleteAllOptions('cautare', 'loc2');
	AddOption('cautare', 'loc2', '--selectati--', '0') ;
	Disable('cautare', 'loc2');
  }	
}

function getHTTPObject() 
{
	var xmlhttp;
	/*@cc_on
	@if (@_jscript_version >= 5)
	try {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
	try {
	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	} catch (E) {
	xmlhttp = false;
	}
	}
	@else
	xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
		try {
			xmlhttp = new XMLHttpRequest();
		} 
		catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}

var http = getHTTPObject(); 

