<script type="text/javascript" src="http://api.maps.rambler.ru/js/"></script>
<script type="text/javascript">

var lat1 = 0.;
var lon1 = 0.;
var Datetime;
var Speed = 0;
var MapNeedMove = 1;
var TrackNeedDraw = 0;
var start = false;
var line = false;
var Alias;

var old_lat = 0.;
var old_lon = 0.;

window.onload = function () {

	setInterval(movePlacemark, 1000);        
}

function movePlacemark()
{
	if(lat1)
	{
		if(!start)
		{
	        	map = new RMap("MyMap", {
//подключаем виджет <Линейка> и отключаем <Маршрутизацию> 
			widgets: {Ruler: true, Routing: false, Cameras: false, Traffic: false}, center:{lat: lat1, lon: lon1}, zoom: 13});
			post = map.geometry.create("marker", {coord: map.makeCoord({lat: lat1, lon: lon1})}, true);
			post.addBalloon({content: {name : '<B>' + Alias + '</B>' + '<BR>' + Datetime + '<BR>' + Speed + 'км/ч'}, template: "${name}"});
			start = true;
		}
		if(lat1 != old_lat || lon1 != old_lon)
		{
			post.setCoord({lat: lat1, lon: lon1});
			post.balloon.setContent({content: {name : '<B>' + Alias + '</B>' + '<BR>' + Datetime + '<BR>' + Speed + 'км/ч'}, template: "${name}"});
       			post.balloon.update();
       			post.update();

			if(TrackNeedDraw == 1)
			{
				if(!line)
				{
					line = map.geometry.create("polyline", {points: [{lat:lat1,lon:lon1}]}, true);
					line.setView({style: {lineHeight: 5, color: 'red', lineOpacity: 0.9 }});
				}
				line.addPoint([lat1,lon1]);
			}
			if(MapNeedMove == 1)
			{       	
				map.moveTo({lat: lat1, lon: lon1}, true);
			}
			old_lat = lat1;
			old_lon = lon1;
		}
	}
}
</script>
<BODY>
    <div id="MyMap" style="width:100%;height:100%"></div>
</BODY>
