﻿    YMaps.jQuery(function () {
        var map = new YMaps.Map(YMaps.jQuery("#YMapsID-4256")[0]);
        map.setCenter(new YMaps.GeoPoint(39.900122,57.610259), 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);

        map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(39.906066, 57.610512), "constructor#pmgnmPlacemark", "<div class=\"balloontext\">&laquo;Айскрим&raquo;</br>Ярославль, Коровницкий переулок, 18</div>"));
        
        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;
        }
    });