YMaps.jQuery(function () {
	var map = new YMaps.Map(YMaps.jQuery("#YMapsID-3613")[0]);
	map.setCenter(new YMaps.GeoPoint(37.630424,55.780921), 16, YMaps.MapType.HYBRID);
	map.addControl(new YMaps.Zoom());
	map.addControl(new YMaps.ToolBar());
	map.addControl(new YMaps.TypeControl());

	YMaps.Styles.add("constructor#pmlbm1Placemark", {
		iconStyle : {
		    href : "http://api-maps.yandex.ru/i/0.3/placemarks/pmlbm1.png",
			size : new YMaps.Point(28,29),
			offset: new YMaps.Point(-8,-27)
			}
	    });


	YMaps.Styles.add("constructor#pmlbm2Placemark", {
		iconStyle : {
		    href : "http://api-maps.yandex.ru/i/0.3/placemarks/pmlbm2.png",
			size : new YMaps.Point(28,29),
			offset: new YMaps.Point(-8,-27)
			}
	    });


	YMaps.Styles.add("constructor#pmlbm3Placemark", {
		iconStyle : {
		    href : "http://api-maps.yandex.ru/i/0.3/placemarks/pmlbm3.png",
			size : new YMaps.Point(28,29),
			offset: new YMaps.Point(-8,-27)
			}
	    });


	YMaps.Styles.add("constructor#FF3732c85Polyline", {
		lineStyle : {
		    strokeColor : "FF3732c8",
			strokeWidth : 5
			}
	    });
	map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(37.632892,55.780467), "constructor#pmlbm1Placemark", "Выход с подхемного перехода<br/>"));
	map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(37.62801,55.780367), "constructor#pmlbm2Placemark", "Кассы.<br/>"));
	map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(37.62727,55.780162), "constructor#pmlbm3Placemark", "Вход во второй подъезд.<br/>Вам сюда!"));
	map.addOverlay(createObject("Polyline", [new YMaps.GeoPoint(37.632891,55.780436),new YMaps.GeoPoint(37.631411,55.780702),new YMaps.GeoPoint(37.631164,55.780575),new YMaps.GeoPoint(37.628171,55.780811),new YMaps.GeoPoint(37.62802,55.78037),new YMaps.GeoPoint(37.627248,55.780158)], "constructor#FF3732c85Polyline", "Как пройти от метро к Книжному Клубу \"Олимпийский\""));
  
	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;
	}
    });

