function cierra() 
{
	if (document.getElementById('options').style.display == 'none')
	{
		document.getElementById('options').style.display = 'block';	
	}
	else
	{
		document.getElementById('options').style.display = 'none';
	}
}

function cambiaModo(modo){
	try
	{   
		var centro = map.GetCenter();
		var lv = map.GetZoomLevel();
		
		if ((modo == 'o') && (map.IsBirdseyeAvailable())) // && (lv>9))
		{
		map.SetMapStyle(modo);
		map.SetCenter(centro);
		}
		else if ((modo == 'o') && (!map.IsBirdseyeAvailable()))
		{
		document.getElementById("aer").disabled = true;
		}
		else
		{
		map.SetMapStyle(modo);
		map.SetCenter(centro);
		}
		
				
		document.getElementById('map').className = '';
		document.getElementById('sat').className = '';
		document.getElementById('hyb').className = '';
		document.getElementById('aer').className = '';		
		
		if(modo == 'r')
		{
		    if (lv == 5){
			document.getElementById("ZoomCanarias").style.display = "block";   
			}
			if (map.IsBirdseyeAvailable()){
			document.getElementById("aer").disabled = false;
			}
			document.getElementById('impres').style.display = 'block';
			document.getElementById('girader').style.display = 'none';
			document.getElementById('giraizq').style.display = 'none';
			document.getElementById('map').className = 'activo';			
		}
		else if(modo == 'a')
		{
			document.getElementById("ZoomCanarias").style.display = "none";   
			document.getElementById('impres').style.display = 'none';
			document.getElementById('girader').style.display = 'none';
			document.getElementById('giraizq').style.display = 'none';
			document.getElementById('sat').className = 'activo';			
		}
		else if(modo == 'h')
		{
			document.getElementById("ZoomCanarias").style.display = "none";   
			document.getElementById('impres').style.display = 'none';
			document.getElementById('girader').style.display = 'none';
			document.getElementById('giraizq').style.display = 'none';
			document.getElementById('hyb').className = 'activo';			
		}
		else if(modo == 'o')
		{
			if (map.IsBirdseyeAvailable()) // && (lv>9))
			{
			document.getElementById('impres').style.display = 'none';
			document.getElementById('girader').style.display = 'block';
			document.getElementById('giraizq').style.display = 'block';
			document.getElementById('aer').className = 'activo';
			}
		}		

	}
	catch(e)
	{
		if (g_sMostrarAlert == "true")
		{
			for (atributo in e) alert("e[" + atributo + "] = " + e[atributo]);
		}
	}
}

function zoom(op){
	try{
		var lv = map.GetZoomLevel();
		var modo = map.GetMapStyle();
				
		if (modo == 'o')
		{
			if (op=='+')
			{
				if (lv<4) map.SetZoomLevel(lv+1);
				//parent.document.getElementById("ZOOM").innerHTML="El zoom del mapa es:" +map.GetZoomLevel();
			}
			else			
			{
				if (lv>0) map.SetZoomLevel(lv-1);
				//parent.document.getElementById("ZOOM").innerHTML="El zoom del mapa es:" +map.GetZoomLevel();
			}		
		}
		else
		{
			if (op == '+')
			{
				if (lv<18) map.SetZoomLevel(lv+1);
				//parent.document.getElementById("ZOOM").innerHTML="El zoom del mapa es:" +map.GetZoomLevel();
			}
			else
			{
				if (lv>5) map.SetZoomLevel(lv-1);
				//var latlonFinal = new VELatLong(40.417162885214, -3.70191941457778);
				//alert(latlonFinal);
				//map.SetCenterAndZoomLevel(latlonFinal,);
				//parent.document.getElementById("ZOOM").innerHTML="El zoom del mapa es:" +map.GetZoomLevel();
				
			}
		}
	}catch(e)
	{
		if (g_sMostrarAlert == "true")
		{
			for (atributo in e) alert("e[" + atributo + "] = " + e[atributo]);
		}
	}
}


var pos = 0;
function girarder()
{
	var sBrujula;

	pos = pos +1;
	if (pos > 3){
		pos = 0;
	}	
	switch(pos){
		case 0:	
			map.SetBirdseyeOrientation(VEOrientation.North);
			sBrujula = "/images/brujula.gif";
		break;
		case 1:
			map.SetBirdseyeOrientation(VEOrientation.East);
			sBrujula = "/images/brujula_4.gif";
		break;
		case 2:
			map.SetBirdseyeOrientation(VEOrientation.South);
			sBrujula = "/images/brujula_3.gif";
		break;
		case 3:
			map.SetBirdseyeOrientation(VEOrientation.West);
			sBrujula = "/images/brujula_2.gif";
		break;
	}		
	
	
	document.getElementById("imgbrujula").src = sBrujula;
	
}
	
function girarizq()
{
	var sBrujula;

	pos = pos -1;	
	if (pos < 0){
		pos = 3;
	}
	switch(pos){
		case 0:	
			map.SetBirdseyeOrientation(VEOrientation.North);
			sBrujula = "/images/brujula.gif";
		break;
		case 1:
			map.SetBirdseyeOrientation(VEOrientation.East);
			sBrujula = "/images/brujula_4.gif";
		break;
		case 2:
			map.SetBirdseyeOrientation(VEOrientation.South);
			sBrujula = "/images/brujula_3.gif";
		break;
		case 3:
			map.SetBirdseyeOrientation(VEOrientation.West);
			sBrujula = "/images/brujula_2.gif";
		break;
	}


	document.getElementById("imgbrujula").src = sBrujula;

}

function mostrarNorte()
{
	try
	{
		StartContinuousPan(0,-10);
	}
	catch(e){}
}
        
function mostrarEste()
{
	try
	{
		StartContinuousPan(10,0);
	}
	catch(e){}
}
	
function mostrarSur()
{
	try
	{
		StartContinuousPan(0,10);
	}
	catch(e){}
}
	
function mostrarOeste()
{
	try
	{
		StartContinuousPan(-10,0);
	}
	catch(e){}
}

function EndContinuousPan()
{
	map.EndContinuousPan();
}
		
function StartContinuousPan(x,y)
{
	map.StartContinuousPan(x,y);

}

