function openAjax(){
	var ajax;
	try{
		ajax = new XMLHttpRequest();
	}catch(ee){
		try{
			ajax = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(e){
			try{
				ajax = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(E){
				ajax = false;
			}
		}
	}
	return ajax;
}
//-----------------------------------------------------------------------------------------------
function pegarAno(idcat){
	var xmlHttp = openAjax();
	var sURL = 'pages/pegar_ano.php?idc='+idcat;
	xmlHttp.open('GET', sURL, true);
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4){
			if (xmlHttp.status == 200){
				var anos = xmlHttp.responseText;
				var arrAnos = anos.split("|");
				var pai = document.getElementById('cat'+idcat);
				var grpAnos = document.createElement('ul');
				grpAnos.setAttribute('id', 'anocat'+idcat);
				
				for (var a = 0; a < arrAnos.length - 1;a++){
					var itemAno = document.createElement('li');
					itemAno.setAttribute('id', 'ano'+idcat+'-'+arrAnos);
					grpAnos.appendChild(itemAno);
					itemAno.innerHTML = '<a href="?a=4&idc='+idcat+'&ano='+arrAnos[a]+'">'+arrAnos[a]+'</a>'+"\n\r";
				}
				
				if (!document.getElementById('anocat'+idcat)){
					pai.appendChild(grpAnos);
				}else{
					grpAnos.parentNode.removeChild(grpAnos);
				}
			}
		}
	}
	xmlHttp.send(null);
	return false;
}