function CreateSubcategories(ccid, url){
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null){
		alert ("Browser does not support HTTP Request")
		return
	}

	//alert(ccid);
	var params = "ccid="+ccid;
	
	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=stateChangedCategory
	xmlHttp.send(params)
}

function stateChangedCategory(){ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){
		
		str = xmlHttp.responseText;
		start_subcat = str.indexOf('<!--%START_SUBCAT%-->');
		end_subcat = str.indexOf('<!--%END_SUBCAT%-->');
		part_subcat = str.slice(start_subcat, end_subcat);
		document.getElementById("subcategories_container").innerHTML=part_subcat;		
		//alert(document.getElementById("subcategories_container").innerHTML)
	}
}


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