// JavaScript Document
Ajax=function(){
   
	var xmlhttp=false;
	try {
		xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch (e) {
		try {
			xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
		} catch (E) {
			xmlhttp = false;
		}
	}

	if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
} 

Ajax.loadContent=function(url,method,contentOutput,type)
{
	var output=document.getElementById(contentOutput);
	ajax=Ajax();
	var rndNum=parseInt(Math.random()*99999999);
	
	ajax.onreadystatechange=function()
	{
		if(ajax.readyState==1)
		{
			output.innerHTML="...Cargando...";
		}
		else if(ajax.readyState==4)
		{
			if(ajax.status==200)
			{
				
					
				output.innerHTML=XML.getInfo(ajax.responseXML,type);
				/*}else{
					output.innerHTML=ajax.responseText;	
				}*/
			}
			else
			{
				output.innerHTML="Document not found!";	
			}
		}
	}
	location.hash=type;
	ajax.open(method,url+"?rand="+rndNum,true);
	ajax.send(null);
}
XML={
	getInfo:function(xmlDoc,type)
	{
		var oXml=xmlDoc.getElementsByTagName('section');
		for(var i=0;i<oXml.length;i++)
		{
			//alert(i);
			if(oXml[i].getAttribute('name')==type)
			{
				//return XML.getHtml(oXml[i]);
				//alert( oXml[i].getElementsByTagName('html2')[0].childNodes[0].nodeValue);
				return oXml[i].getElementsByTagName('html')[0].childNodes[0].nodeValue;
			}
		}
		alert("Type of element not found: "+type);
	},
	getHtml:function(oSection)
	{
		var myHtml=oSection.getElementsByTagName('html');
		alert(oSection.childNodes[0].data);
			return oSection.childNodes[0].data;
	},

	showCompanyLayer2:function(info)
	{
		//setTimeout('show()',2000);
		
		var ballon=document.getElementById("company_info");
		
		
		if(ballon)
		{
			
			
				getMouseXY;
				ballon.innerHTML=info;
				ballon.style.display="inline";
							var layX=ballon.style.width;
				var layY=ballon.style.height;
				ballon.style.left=X-202+"px";
				ballon.style.top=Y-62+"px";
			
	
		}
	}
}
function hidePanels(exceptuationPanels)
{
	if(exceptuationPanels)
	{
		if(exceptuationPanels=='CollapsiblePanel1')
		{
			eval('CollapsiblePanel2.close()');	
		}
		else if(exceptuationPanels=='CollapsiblePanel2')
		{
			eval('CollapsiblePanel1.close()');	
		}
		
		return;	
	}
	CollapsiblePanel1.close();
	CollapsiblePanel2.close();
}
function init()
{
	if(location.hash!='undefined')
	{
		//Ajax.loadContent('ES/as-pack.xml','GET','col3_content',location.hash);	
	}
//document.onmousemove = getMouseXY;
//if (document.layers) document.captureevents(event.getMouseXY);
}
document.onload=init();

