/***********************
*
* 		BUBBLES
*
***********************/

function showToolTip(e,text) {
	if(document.all)e = event;
	var obj = document.getElementById('bubble_tooltip');
	var obj2 = document.getElementById('bubble_tooltip_content');
	obj2.innerHTML = text;
	obj.style.display = 'block';
	var st = Math.max(document.body.scrollTop,document.documentElement.scrollTop);
			
	if(navigator.userAgent.toLowerCase().indexOf('safari')>=0)st=0; 
	var leftPos = e.clientX - 100;
	if(leftPos<0)leftPos = 0;
	obj.style.left = leftPos + 'px';
	obj.style.top = e.clientY - obj.offsetHeight -1 + st + 'px';
		
}	
	
function hideToolTip() {
	document.getElementById('bubble_tooltip').style.display = 'none';
		
}


/***********************
*
* 		MENUS
*
***********************/

function muestraMenu(id) {
	
	var d = document.getElementById(id);
		
	if (d) 
	{
		
		d.style.display='block';
	}
}

function escondeMenu(id){
	
	var d = document.getElementById(id);
	
	if (d) 
	{
		d.style.display='none';
	}
}

/***********************
*
* 		DESCRIPCIONES NAV,NAV_TOP
*
***********************/

function muestraDescripcion(obj,text){
	var hometext = document.getElementById(text);
	var title    = obj.getAttribute('title');
	
	
	
	if(title && hometext)
	{
		hometext.innerHTML = title;
	}
	
}

function muestraDescripcionPorTitulo(title,text){
	
	
	
	//var title    = obj.innerHTML;

	var hometext = document.getElementById(text);
		
	//alert(title);
	
	if(hometext)
	{
		hometext.innerHTML = title;
	}
	
}

function borraDescripcion(){
	var hometext = document.getElementById("hometext");
	var hometext_nav_top = document.getElementById("hometext_nav_top");
	
	if(hometext)
	{
		hometext.innerHTML = '';
	}
	
	if(hometext_nav_top)
	{
		hometext_nav_top.innerHTML = '';
	}
}

/***********************
*
* 		MAPA
*
***********************/


var map = null;
var cuaedVELatLong = null;
var catedVELatLong = null;
var rectoriaVELatLong = null;
var centroVELatLong = null;
var dgscaVELatLong = null;
var trabajosocialVELatLong = null;

            
function GetMap()
{
	//cuaedVELatLong = new VELatLong(19.3226205, -99.1873301);
	cuaedVELatLong = new VELatLong(19.322179, -99.186179);
	catedVELatLong = new VELatLong(19.365364, -98.131127);
	rectoriaVELatLong = new VELatLong(19.333619, -99.185128);
	centroVELatLong = new VELatLong(19.326897, -99.185342);
	dgscaVELatLong  = new VELatLong(19.322462, -99.184463);
	trabajosocialVELatLong = new VELatLong(19.324200, -99.186244);
	
	map = new VEMap('myMap');            
	map.LoadMap(centroVELatLong, 15, 'r', false);
	var pin = new VEPushpin(1,cuaedVELatLong ,'imagenes/pin_cuaed.gif',"Coordinaci&oacute;n de Universidad Abierta y Educaci&oacute;n a Distancia","Circuito Exterior, Ciudad Universitaria, M&#0233;xico, D.F., C.P. 04510 <br/> <a href='http://www.cuaed.unam.mx'>www.cuaed.unam.mx</a>");         
	
	var pinCATED = new VEPushpin(2,catedVELatLong ,'imagenes/cated.gif',"Centro de Alta Tecnolog&iacute;a de Educaci&oacute;n a Distancia","Ex-f&#0225;brica de San Manuel, Domicilio Conocido, San Miguel Contla, Santa Cruz Tlaxcala, Tlaxcala CP 90640 <br/> <a href='http://www.cuaed.unam.mx/cated/'>www.cuaed.unam.mx/cated/</a><p style=\"margin: 6px;\"><a href=\"imagenes/mapa_gde.pdf\" alt=\"\" target=\"_blank\"><img style=\"border:none;\" src=\"imagenes/mapa_pq.gif\" alt=\"Mapa del CATED\"/></a><br />Click para ver mapa en formato pdf</p>");
	
	var pinRectoria = new VEPushpin(3,rectoriaVELatLong ,'imagenes/pin_rectoria.gif',"Rector&iacute;a UNAM",null);
	
	var pinDGSCA = new VEPushpin(4,dgscaVELatLong ,'imagenes/pin_dgsca.gif',"DGSCA UNAM",null);
	var pinTS = new VEPushpin(5,trabajosocialVELatLong ,'imagenes/pin_trabajo.gif',"Trabajo Social",null);
	
	map.AddPushpin(pin);
	map.AddPushpin(pinCATED);
	map.AddPushpin(pinRectoria);
	map.AddPushpin(pinDGSCA);
	map.AddPushpin(pinTS);
	
	//map.AttachEvent('onmodenotavailable', No3DInstalled);
	
	
	AddMyControl();
	//map.AttachEvent('onclick', onMapClick);
	
}

function No3DInstalled ()
{
    alert('Para ver los mapas en modo 3D, '+
      'se requiere que instale el software Virtual Earth 3D en su computadoraS.' +
      '\n Para instalar el software, visite ' +
      'http://go.microsoft.com/fwlink/?LinkId=72623.');
}



function CenterCUAED()
{
	map.SetCenterAndZoom(centroVELatLong,15);
}

function CenterCATED()
{
	map.SetCenterAndZoom(catedVELatLong,12);
}


function AddMyControl()
{
	var el = document.createElement("div");
	el.id = "MyControl";
	
	el.style.top = "250px";
	el.style.left = "15px";
	el.style.padding = "4px";
	el.style.width = "150px";
	el.style.height = "40px";
	el.style.border = "1px solid gray";
	el.style.background = "#FFFFFF";
	
    el.innerHTML = '<a href="javascript:CenterCUAED();">Ubicar la CUAED</a>';
	el.innerHTML += '<br />';
	el.innerHTML += '<a href="javascript:CenterCATED();">Ubicar el CATED</a>';
    map.AddControl(el);
	//addShim(el);
}

function addShim(el)         
{            
	var shim = document.createElement("iframe");            
	shim.id = "myShim";            
	shim.frameBorder = "0";            
	shim.style.position = "absolute";            
	shim.style.zIndex = "1";            
	shim.style.top  = el.offsetTop;            
	shim.style.left = el.offsetLeft;            
	shim.width  = el.offsetWidth;            
	shim.height = el.offsetHeight;            
	el.shimElement = shim;            
	el.parentNode.insertBefore(shim, el);         
}


function onMapClick(e)
{
	//var pinDGSCA = new VEPushpin(4,e.view.LatLong ,'imagenes/pin_dgsca.gif',"DGSCA UNAM",null);
	//map.AddPushpin(pinDGSCA);
	
	//alert(e.view.LatLong);	
}



/***********************
*
* 		ACCESABILIDAD
*
***********************/

var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function tam_letra( trgt,inc ) {
	if (!document.getElementById) return;
	if (!document.getElementById(trgt)) return;
	
	var d = document,cEl = null,sz = startSz;
	
	
	if(inc == 0)
	{
		sz = 2;
		startSz = sz;
	}else
	{
		sz += inc;
		if ( sz < 0 ) sz = 0;
		if ( sz > 6 ) sz = 6;
		startSz = sz;
	}
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.style.fontSize = szs[ sz ];
}








