//var xmlHttp
//var itemID

function get_subcategories(ccid){
	
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
 
	var params = "ccid="+ccid;
	var url=HOST_LANG+"ajax_select_subcategories.php";
	xmlHttp.open("POST",url,true)
	//Send the proper header information along with the request
	xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	xmlHttp.setRequestHeader("Content-length", params.length);
	xmlHttp.setRequestHeader("Connection", "close");
		
	xmlHttp.onreadystatechange=stateChangedSubcategory
	xmlHttp.send(params)
}

function stateChangedSubcategory() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 {
 	
	xmlDoc = xmlHttp.responseXML;
	container = document.getElementById('subcat_ccid');
	container.innerHTML = "";
	
	x = xmlDoc.getElementsByTagName("subcategory");
	
	option = document.createElement("option");
	option.innerHTML =   'Alege';
	option.value  =  '';
	container.appendChild(option);
	
	for(i=0;i<x.length;i++){		
		
		option = document.createElement("option");
		option.innerHTML =   x[i].childNodes[1].firstChild.nodeValue ;
		option.value  =  x[i].childNodes[0].firstChild.nodeValue ;
		container.appendChild(option);
		 
	}
 
 } 
}

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


