﻿    YMaps.jQuery(function () {
        var map = new YMaps.Map(YMaps.jQuery("#YMapsID-364")[0]);
        map.setCenter(new YMaps.GeoPoint(37.579559,54.170792), 15, YMaps.MapType.MAP);
        map.addControl(new YMaps.Zoom());
        map.addControl(new YMaps.ToolBar());
        map.addControl(new YMaps.TypeControl());

        // Создает стиль
        var s = new YMaps.Style();
        // Создает стиль значка метки
        s.iconStyle = new YMaps.IconStyle()
        s.iconStyle.href = "/files/images/map_pointer1.png";
        s.iconStyle.size = new YMaps.Point(55, 55)
        s.iconStyle.offset = new YMaps.Point(-21, -51);
        YMaps.Styles.add("constructor#pmgnmPlacemark", s);
		
        YMaps.Styles.add("constructor#pmlbmPlacemark", {
        	iconStyle: {
        		href: "/files/images/map_autobus.png",
        		size: new YMaps.Point(42, 42),
        		offset: new YMaps.Point(-10, -20)
        	}
        });
		
        YMaps.Styles.add("constructor#33CC00c85Polyline", {
            lineStyle : {
                strokeColor : "33CC00c8",
                strokeWidth : 5
            }
        });
              map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(37.574173, 54.172467), "constructor#pmgnmPlacemark", "<div class=\"balloontext\"> &laquo;SeoPlanet&raquo;<br/>300028, Тула, Болдина 98, офис 603</div>"));
              map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(37.575632, 54.171963), "constructor#pmlbmPlacemark", "<div class=\"balloontext\">Остановка «Весна» <br/>на троллейбусах: 5, 4, 10;<br/>автобусах: 11, 50, 40к, 22.</div>"));
       //map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(37.575128,54.172272), "constructor#pmlbmPlacemark", "остановка «Весна» <br/>на троллейбусах: 5, 4, 10;<br/>автобусах: 11, 50, 40к, 22."));
       map.addOverlay(createObject("Polyline", [new YMaps.GeoPoint(37.573969,54.172165),new YMaps.GeoPoint(37.574945,54.171812),new YMaps.GeoPoint(37.575138,54.172095)], "constructor#33CC00c85Polyline", ""));
        
        function createObject (type, point, style, description) {
            var allowObjects = ["Placemark", "Polyline", "Polygon"],
                index = YMaps.jQuery.inArray( type, allowObjects),
                constructor = allowObjects[(index == -1) ? 0 : index];
                description = description || "";
            
            var object = new YMaps[constructor](point, {style: style, hasBalloon : !!description});
            object.description = description;
            
            return object;
        }
    });