function VirtualEarthMapProvider()
{
	this.name = 'Microsoft Live Virtual Earth';
	this.LoadMap = vempLoadMap;
	this.DisposeMap = vempDisposeMap;
	this.LatLong = vempLatLong;
	this.AddMarker = vempAddMarker;
	this.ClearMap = vempClearMap;
	this.SetCentreAndZoom = vempSetCentreAndZoom;
}
VirtualEarthMapProvider.prototype = new MapProvider;
	
function vempLoadMap(div_name)
{
	this.map = new VEMap(div_name)
	this.div = div_name;
   	this.map.LoadMap(
   	    new VELatLong(
   	        50.614617438266265,
   	   	    -4.3231201171875035
   	   	),
   	   	8,
   	   	'r',
   	   	false,
   	   	VEMapMode.Mode2D,
   	   	false
   	);
	this.map.Resize(540, 380);
}

function vempDisposeMap()
{
	/* Dispose the existing map */
	deleteContent(document.getElementById(this.div));
	this.map = null;
}

function vempLatLong(lat, long)
{
	var point = new VELatLong(lat, long);
	return point;
}

function vempAddMarker(id, pos, title, desc, icon, iconstyle, allowclick) {
	
		var pin = new VEPushpin(
			id,
			pos,
			icon,
			title,
			desc,
			iconstyle
		);
		this.map.AddPushpin(pin);
		if (allowclick)
			document.getElementById(id).onclick = function()
			{
				map.map.SetCenterAndZoom(pos, 14);
			}
}

function vempClearMap()
{
	if (this.map != null) {
        this.map.Clear();
        this.map.SetCenterAndZoom(new VELatLong(50.614617438266265, -4.3231201171875035), 8);
    }
}

function vempSetCentreAndZoom(pos, level)
{
	this.map.SetCenterAndZoom(pos, level);
}