var map = null;
var layer = null;
var noduri = [];

function viewLocation(Lat,Lon,Location) {
	var point = new VELatLong(Lat,Lon);
	var shape = new VEShape(VEShapeType.Pushpin,point);
	shape.SetTitle(Location);
	var icon = new VECustomIconSpecification();
	icon.Image = "/img/markerN.png";
	icon.ImageOffset = new VEPixel(8,8);
	icon.TextContent = '  ';
	shape.SetCustomIcon(icon);
	addLayer();
	layer.AddShape(shape);
	noduri.push(point);
}

function viewIntersection(Lat,Lon) {
	var point = new VELatLong(Lat,Lon);
	var shape = new VEShape(VEShapeType.Pushpin,point);
	var icon = new VECustomIconSpecification();
	icon.Image = "/img/markerX.png";
	icon.ImageOffset = new VEPixel(8,8);
	icon.TextContent = '  ';
	shape.SetCustomIcon(icon);
	addLayer();
	layer.AddShape(shape);
	noduri.push(point);
}

function drawRoute(r,g,b,a,Description) {
	var route = new VEShape(VEShapeType.Polyline, drum);
	route.SetLineWidth(3);
	var icon = new VECustomIconSpecification();
	icon.Image = "/img/marker0.png";
	route.SetCustomIcon(icon);
	route.SetLineColor(new VEColor(r,g,b,a));
	layer.AddShape(route);
	map.SetMapView(drum);
	//setTimeout("map.ZoomIn();",500);
	
}

function drawRestrictionRoute(source, destination, restriction, road, r,g,b,a) {
	var drum = [];
	drum.push(source);
	drum.push(destination);
	var route = new VEShape(VEShapeType.Polyline, drum);
	route.SetLineWidth(3);
	var icon = new VECustomIconSpecification();
	road='';
	if(road!='') {
		icon.CustomHTML = "<span style='font-size:8px; background: #FFFFCC; border: 1px solid #000000; color: #000000; filter:alpha(opacity=90); -moz-opacity: 0.9; opacity: 0.9;'>" + road + "</span>";
	} else {
		icon.Image = "/img/marker0.png";
		//icon.TextContent = road;
		//icon.ForeColor = new VEColor(0,0,0,a);
		//icon.TextSize = 8;
		//icon.BackColor = new VEColor(255,255,0,1);
	}
	route.SetCustomIcon(icon);
	route.SetLineColor(new VEColor(r,g,b,a));
	route.SetTitle(restriction);
	layer.AddShape(route);
}

function addLayer() {
	if(layer==null) {
		layer = new VEShapeLayer();
		map.AddShapeLayer(layer);
	}
}

function removeMarkers() {
	map.DeleteAllShapeLayers();
	layer = null;
	drum = [];
}
