var Ajax2 = new Object();

Ajax2.Request = function(url,id,url2,id2,callbackMethod)
{
	if ( id == 0 )
	{
		return;
	}

	Ajax2.request = Ajax.createRequestObject();
	Ajax2.request.onreadystatechange = callbackMethod;
	Ajax2.request.open("POST", url+id+url2+id2, true);
	Ajax2.request.send(url);
}

Ajax2.Response = function ()
{
	if(Ajax.CheckReadyState(Ajax2.request))
	{		
		var sel = document.getElementById('dt_id_pais');
		while (sel.firstChild) {
			sel.removeChild(sel.firstChild);
		}
		document.getElementById('dt_id_pais').length = 0;
		document.getElementById('dt_id_pais').options[0] = new Option("Seleccionar...","0");
		
		var	response = Ajax2.request.responseXML.documentElement;
		var _data = response.getElementsByTagName('category');
		if(_data.length == 0)
		{
			document.getElementById('dt_id_pais').options[0] = new Option("Seleccionar...",'0');	
		}
		var i
		for ( i = 0 ; i < _data.length ; i ++ )
		{
			if (response.getElementsByTagName('id')[i].firstChild.data ==-2){
				objSelect=document.getElementById('dt_id_pais');
				optGroup = document.createElement('optgroup')
				optGroup.label = response.getElementsByTagName('fname')[i].firstChild.data				
				objSelect.appendChild(optGroup);
			}else{
				document.getElementById('dt_id_pais').options[i] = new Option(response.getElementsByTagName('fname')[i].firstChild.data,response.getElementsByTagName('id')[i].firstChild.data);
				optGroup.appendChild(document.getElementById('dt_id_pais').options[i]);
			}
		}
	}
}

Ajax2.createRequestObject = function()
{
	var obj;
	if(window.XMLHttpRequest)
	{
		obj = new XMLHttpRequest();
	}
	else if(window.ActiveXObject)
	{
		obj = new ActiveXObject("MSXML2.XMLHTTP");
	}
	return obj;
}