var map;
var _weatherTimer;

function loadMap()
{
	window.onresize = function()
	{ 
		document.getElementById("map").style.width = (GetWindowWidthHeight().width-128)+"px";	
		document.getElementById("map").style.height = (GetWindowWidthHeight().height-150)+"px";	
	}
	
	window.onresize();
	
	map = new FE.Map(document.getElementById("map"));
	map.onLoad = onMapLoad;
	map.load();
}

function rotate()
{
	var target = map.getTargetLatLng();
	target.lng -= 0.6;
	if (target.lng < -180) target.lng = 180;
	
	map.setTargetLatLng(target);	
}

function stopRotation() {
 clearInterval(rotInterval);
}

var rotInterval;
function onMapLoad()
{
	this.zoomTo(FE.Map.RADIUS*2);
	this.setTargetLatLng(new FE.LatLng(30,170));
	this.getCamera().setLngInertia(-0.15);
//	rotInterval = setInterval(rotate, 100);
	setTimeout('_weatherTimer = setInterval("showWeatherData();", 80)', 1400);
	this._container.onmousedown = stopRotation;
//	Event.observe(this._container, 'mousedown', stopRotation);
}

function GetWindowWidthHeight()
{
	var myWidth = 0, myHeight = 0;
	if(typeof(window.innerWidth) == 'number')
	{
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	}
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
	{
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight))
	{
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	return {'width' : myWidth, 'height' : myHeight};
}
