// JavaScript Document
var activo = 'default';

function texto2 (http, div_name) 
{ 

	var LINK_xmlhttp = false;

	try 
	{ 
		LINK_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch (e) 
	{ 
		try 
		{ 
			LINK_xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
		catch (e) 
		{ 
			try 
			{ 
				LINK_xmlhttp = new XMLHttpRequest(); 
			}
			catch (e) 
			{ 
				LINK_xmlhttp = false; 
			}
		}
	}
	if (!LINK_xmlhttp) return null;
	

	LINK_xmlhttp.open("GET", http, true);

	LINK_xmlhttp.onreadystatechange = function() 
	{
		if (LINK_xmlhttp.readyState == 4) 
		{
			document.getElementById(div_name).innerHTML = LINK_xmlhttp.responseText + ' ';
			desactivar(activo);
			activo = div_name;
			$(div_name).appear({duration: 0.5 });
		}
	}

	LINK_xmlhttp.send(null);  

	return false;
}


function activar(nuevoDiv)
{
	var nuevo;
	if(activo == 'contenido1')
		nuevo = 'contenido2';
	else
		nuevo = 'contenido1';
	texto2(nuevoDiv,nuevo);
	return false;
}
function desactivar(anterior)
{
	Effect.toggle(anterior,'appear',{ duration: 0.5 });
}
function mostrarInfo(nombre,direccion,comuna,region,fono,div,x,y)
{
	var mensaje = document.getElementById(div);
	//Effect.toggle(div,'appear',{ duration: 0.1 });
	img = document.getElementById('alfiler2');
	mensaje.style.top = (y-154) + 'px';
	mensaje.style.left = (x+5) + 'px';
	
	var msg = '<b>'+nombre+'</b><br />Direcci&oacute;n: '+direccion+'<br />Comuna: '+comuna+'<br />Regi&oacute;n: '+region+'<br />Tel&eacute;fono: '+fono; //+'<br />'+mensaje.style.left+'<br />'+mensaje.style.top+'<br />'+img.style.left+'<br />'+img.style.top;
	
	mensaje.innerHTML = msg;
	
	mensaje.style.display = 'block';
	
	
}
function ocultar(div)
{
	var mensaje = document.getElementById(div);
	mensaje.style.display = 'none';
	//Effect.toggle(div,'appear',{ duration: 0.1 });
}
function position(event){
	var x = event.clientX - 383;
	var y = event.clientY - 250;
	//var div = document.getElementById('sigueMouse');
	//div.style.top = (y-10)+'px';
	//div.style.left = (x+20)+'px';
	var mousePositions = document.getElementById('coordenadas');
	mousePositions.innerHTML = 'X coords: '+x+', Y coords: '+y;

}