<script type="text/javascript" src="http://maps.kosmosnimki.ru/api/api.js?key=H32BVWZGTF"></script>
<script type="text/javascript">

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

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

var map1;
var pt;
var line;

window.onload = function () {
	setInterval(movePlacemark, 500);
}

function movePlacemark()
{
	if(lat1)
	{
		if(!start)
		{
		        createFlashMap(document.getElementById("MyMap"), function(map) 
			{
				map1 = map;
				map1.setBaseLayer("Гибрид");
				map1.miniMap.setVisible(false); //отключить миникарту
				map1.drawing.tools["POINT"].setVisible(false); // отключить инструмент маркеров
				map1.drawing.tools["POLYGON"].setVisible(false); // отключить инструмент рисования полигонов
				map1.drawing.tools["FRAME"].setVisible(false); // отключить инструмент ножницы
				map1.moveTo(lon1, lat1, 12);

				line = map.addObject();
//				line.setGeometry({"type":"LINESTRING","coordinates":[[parseFloat(lon1), parseFloat(lat1)]]});
//				line.setStyle({outline: {color: 0xff0000,thickness: 3,opacity: 100}});

				pt = map1.addObject();
				pt.setGeometry({"type":"POINT",	"coordinates":[parseFloat(lon1), parseFloat(lat1)]});
//				pt.setStyle({marker: {image: "http://maps.kosmosnimki.ru/api/img/marker_flag.png", angle: 180, dx: -3, dy:-26},label: {size: 12,color: 0xffffff,haloColor: 0x000000}});
				pt.setStyle({marker: {image: "http://api-maps.yandex.ru/i/0.4/icons/metroYekaterinburg.png", angle: Angle, dx: -7, dy:-10},label: {size: 12,color: 0xffffff,haloColor: 0x000000}});
//				pt.setStyle({marker: {image: "http://api-maps.yandex.ru/i/0.4/icons/metroYekaterinburg.png", angle: Angle, center: true},label: {size: 12,color: 0xffffff,haloColor: 0x000000}});
//				pt.setStyle({marker: {image: "http://стоп-машина.рф/metroYekaterinburg.png", angle: Angle, center: true},label: {size: 12,color: 0xffffff,haloColor: 0x000000}});

				pt.enableHoverBalloon(function(o) { return '<B>' + Alias + '</B>' + '<BR>' + Datetime + '<BR>' + Speed + 'км/ч'});
				pt.setLabel(Speed + 'км/ч');
			});
			start = true;
		}
		if(lat1 != old_lat || lon1 != old_lon)
		{
			if(TrackNeedDraw == 1)
			{
				if(!line)
				{
					line.setGeometry({"type":"LINESTRING","coordinates":[[parseFloat(lon1), parseFloat(lat1)]]});
					line.setStyle({outline: {color: 0xff0000,thickness: 3,opacity: 100}});
				}
				var geom1 = line.getGeometry();
				geom1.coordinates[geom1.coordinates.length] = [parseFloat(lon1), parseFloat(lat1)];
                                line.setGeometry(geom1);
			}
			pt.setGeometry({"type":"POINT",	"coordinates":[parseFloat(lon1), parseFloat(lat1)]});
			pt.setStyle({marker: {image: "http://api-maps.yandex.ru/i/0.4/icons/metroYekaterinburg.png", angle: Angle, dx: -7, dy:-10},label: {size: 12,color: 0xffffff,haloColor: 0x000000}});
//			pt.setStyle({marker: {image: "http://api-maps.yandex.ru/i/0.4/icons/metroYekaterinburg.png", angle: Angle, center: true},label: {size: 12,color: 0xffffff,haloColor: 0x000000}});
//			pt.setStyle({marker: {image: "http://стоп-машина.рф/metroYekaterinburg.png", angle: Angle, center: true},label: {size: 12,color: 0xffffff,haloColor: 0x000000}});
			pt.setLabel(Speed + 'км/ч');
			if(MapNeedMove == 1)
			{       	
				map1.slideTo(lon1, lat1, map1.getZ());
			}
			old_lat = lat1;
			old_lon = lon1;
		}
	}
}
</script>

<BODY>
    <div id="MyMap" style="width:100%;height:100%"></div>
</BODY>
