function createXMLHttpRequest() {
	if (window.ActiveXObject) {
    	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}else if (window.XMLHttpRequest) {
		xmlHttp = new XMLHttpRequest();                
	}
}
function sottocat(idcat) {
	createXMLHttpRequest();   
    var url = "givemesottocat.php?idcat="+escape(idcat);
	xmlHttp.open("GET", url, true);
	xmlHttp.onreadystatechange = callbacksottocat;
	xmlHttp.send(null);	
}
function callbacksottocat() {
	if (xmlHttp.readyState == 4) {
		if (xmlHttp.status == 200) {
			//var name = xmlHttp.responseXML.getElementsByTagName("name")[0].firstChild.data;
			setSottocat(xmlHttp.responseXML.getElementsByTagName("id")[0].firstChild.data,xmlHttp.responseXML.getElementsByTagName("idcat"),xmlHttp.responseXML.getElementsByTagName("name"));
		} //else if (xmlHttp.status == 204){
			//clearNames();
		//}
	}
}

function setSottocat(id,idcat,the_names) {  
	var size = the_names.length;
	var cat = document.getElementById("catt"+id);
	var temp="";
	//var row, cell, txtNode;
	for (var i = 0; i < size; i++) {
		var nomecat = the_names[i].firstChild.data;
		var idcat2 = idcat[i].firstChild.data;
		
		temp=temp+"<img src=\"Scripts/img/line.gif\" width=\"18\" height=\"18\" border=\"0\"><a href=\"cerca.php?sottocat="+idcat2+"\"><img src=\"images/videosmall.gif\" width=\"18\" height=\"18\" border=\"0\">"+nomecat+"</a><br>";
	}
	cat.innerHTML=temp;
}