﻿YMaps.jQuery(window).load(function () {
	var map = new YMaps.Map(YMaps.jQuery("#YMapsID-65")[0]);
	map.setCenter(new YMaps.GeoPoint(30.45105,60.015009), 13, YMaps.MapType.MAP);
	map.addControl(new YMaps.Zoom());
	map.addControl(new YMaps.ToolBar());
	YMaps.MapType.PMAP.getName = function () { return "Народная"; }
	map.addControl(new YMaps.TypeControl([
		YMaps.MapType.MAP,
		YMaps.MapType.SATELLITE,
		YMaps.MapType.HYBRID,
		YMaps.MapType.PMAP
	], [0, 1, 2, 3]));

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

   map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(30.451565,60.014235), "constructor#pmlbmPlacemark", "\"Транссфера Интернэшнл\"<br />195273, Санкт-Петербург<br />Пискаревский пр., д.150, корп.2<br />Тел. (812) 334-02-34<br />Факс. (812) 334-02-35"));
	
	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;
	}
});
