var colorboxOpts = {
	maxWidth: "96%",
	maxHeight: "96%",
	resize: true,
	opacity: 0.5,
	close: "Закрыть",
	next: "<img src='/i/colorbox/next.png'/>",
	previous: "<img src='/i/colorbox/prev.png'/>",
	close: "<img src='/i/colorbox/close.png'/>",
	current: ""
};

  // create tower style
var Site = {
	map: null,
	gold: null,
	silver: null,
	zoom: 15,
	objects: {
		kurort: { lon: 39.90010, lat: 43.466827, ready: false, name: 'ЖК «Курортный»', desc: 'ул. Ленина, 219А.'},
		ulyanova: { lon: 39.921603, lat: 43.42870, ready: true, name: 'ЖК «Ульянова»', desc: 'ул. Ульянова, 47А.'},
		elit: { lon: 39.924188, lat: 43.424151, ready: true, name: 'ЖК «Элит»', desc: 'ул. Демократическая, 43.'},
		elit2: { lon: 39.923017, lat: 43.423867, ready: true, name: 'ЖК «Элит»', desc: 'ул. Кирова, 30.'},
		ocean: { lon: 39.923617, lat: 43.42375, ready: false, name: 'ТОЦ «Океан»', desc: null}
	},
	
	places: {
		center: { lon: 39.92162529967781, lat: 43.426198374669276 }
	},

	initMap: function()
	{
		// create map
		this.map = new YMaps.Map(document.getElementById("OMap"));
		
		// zoom control
		var ctrl = new YMaps.SmallZoom();
		this.map.addControl(ctrl, new YMaps.ControlPosition(YMaps.ControlPosition.TOP_RIGHT, new YMaps.Size(30, 5)));
		
		// gold tower icon
		this.gold = new YMaps.Style();
		this.gold.iconStyle = new YMaps.IconStyle();
		this.gold.iconStyle.href = 'http://elite-towers.ru/i/tower.gold.icon.png';
		this.gold.iconStyle.size = new YMaps.Point(20, 36);
		this.gold.iconStyle.offset = new YMaps.Point(-10, -36);
		this.gold.iconStyle.shadow = new YMaps.IconShadowStyle();
		this.gold.iconStyle.shadow.href = 'http://elite-towers.ru/i/tower.shadow.icon.png';
		this.gold.iconStyle.shadow.size = new YMaps.Point(42, 22);
		this.gold.iconStyle.shadow.offset = new YMaps.Point(-10, -22);
		
		// silver tower icon
		this.silver = new YMaps.Style();
		this.silver.iconStyle = new YMaps.IconStyle();
		this.silver.iconStyle.href = 'http://elite-towers.ru/i/tower.silver.icon.png';
		this.silver.iconStyle.size = new YMaps.Point(20, 36);
		this.silver.iconStyle.offset = new YMaps.Point(-10, -36);
		this.silver.iconStyle.shadow = new YMaps.IconShadowStyle();
		this.silver.iconStyle.shadow.href = 'http://elite-towers.ru/i/tower.shadow.icon.png';
		this.silver.iconStyle.shadow.size = new YMaps.Point(42, 22);
		this.silver.iconStyle.shadow.offset = new YMaps.Point(-10, -22);
	},
	
	centerMap: function(place, zoom)
	{
		this.map.setCenter(new YMaps.GeoPoint(
			typeof(place) == 'string' ? this.places[place].lon : place.lon,
			typeof(place) == 'string' ? this.places[place].lat : place.lat), zoom);
	},
	
	addTowers: function()
	{
		for(i in this.objects) {
			var o = this.objects[i];
			var tower = new YMaps.Placemark(new YMaps.GeoPoint(o.lon, o.lat), {style: o.ready ? this.gold : this.silver});
			tower.name = o.name;
			tower.description = o.desc;
			this.map.addOverlay(tower);
		}
	},
	
	addPlaces: function()
	{
	}
}
