function CheckMap(objID){
	geoObj = document.getElementById(objID) || false;
	return geoObj;
	
}

mapObject = 'YandexMap';

window.onload = loadMap;

function loadMap() {
	if (CheckMap(mapObject)){
	map = new YMaps.Map(document.getElementById(mapObject));
        //map.setCenter(new YMaps.GeoPoint(30.733333334333,46.466666667667), 13);
	map.setCenter(new YMaps.GeoPoint.fromString(NewCenter), 13);
        
	var typeControl = new YMaps.TypeControl();
        map.addControl(typeControl);
        typeControl.removeType(YMaps.MapType.HYBRID);
        typeControl.removeType(YMaps.MapType.SATELLITE);
        typeControl.removeType(YMaps.MapType.MAP);
        var s = new YMaps.Style();
            s.iconStyle = new YMaps.IconStyle();
            s.iconStyle.href = "/images/point.png";
            s.iconStyle.size = new YMaps.Point(29, 26);
            s.iconStyle.offset = new YMaps.Point(-29, 0);

            /*s.iconStyle.shadow = new YMaps.IconShadowStyle();
            s.iconStyle.shadow.href = "/i/maps/icons/photo-shadow.png";
            s.iconStyle.shadow.size = new YMaps.Point(18, 29);
            s.iconStyle.shadow.offset = new YMaps.Point(-9, -29);*/

        map.addControl(new YMaps.Zoom({
        	smooth: 0,
            customTips: [
                         {index: 7, value: "Область"},
                         {index: 11, value: "Город"},
                         {index: 13, value: "Квартал"},
                         {index: 16, value: "Дом"}
                     ]
                 }));

     
	YMaps.Events.observe(map,map.Events.Update, function () {
		if (map.getZoom()<7)
			map.setZoom(7);
	});
        
		 for (var i=0;i<points.length;i++){
                            var coords = new YMaps.GeoPoint.fromString(points[i].coords);
						 	 	
				var placemark = new YMaps.Placemark(coords, {draggable: 0, style: s,
				    hintOptions: {
				        Width: 400,
				        showTimeout: 200
				        //offset: new YMaps.Point(5, 5)
				    }
				   
				});
				
                               
                               
				//placemark.setIconContent(points[i].link_title);
				placemark.description="<center><b style='font-size:24px;'>"+points[i].title+"</b></center>";
				placemark.description+='<a href="/categories.php?parts_id='+points[i].parts_id+'" style="color: red;">'+points[i].part+"</a><br/>";
				placemark.description+='<a href="javascript:void(0);" style="color: green" onclick="toPoint('+points[i].coords+')">'+points[i].address+"</a><br/>";
				
				map.addOverlay(placemark);
	
		 }
	 
	
    }
}

