function showPopup() {
	var popup = document.getElementById('popup');
  	var popup_close = document.getElementById('popup_close');
  	popup.style.display = 'block';  	
  	popup.style.top = document.documentElement.clientHeight/2-popup.offsetHeight/2+'px';
	popup.style.left = document.documentElement.clientWidth/2+-popup.offsetWidth/2+'px';
	popup.onclick = popup_close.onclick = function() {
		this.style.display = 'none';
	};
	window.onscroll = function() {	
		popup.style.top = document.documentElement.clientHeight/2-popup.offsetHeight/2+document.documentElement.scrollTop+'px';
	};	
}


function addEvent(elm, evType, fn, useCapture) {
    if (elm.addEventListener) {
        elm.addEventListener(evType, fn, useCapture);
        return true;
    }
    else if (elm.attachEvent) {
        var r = elm.attachEvent('on' + evType, fn);
        return r;
    }
    else {
        elm['on' + evType] = fn;
    }
}

function colorPrice() {
	$.each($('#tatyanino_price tr:nth-child(odd)'), function() {
		if(!$(this).is('.nohover')) $(this).css({background: '#d6f0fd'})
	});
}

$(document).ready(function() {
	colorPrice();
	
	
	
	if(document.getElementById("YMapsID")) {
		YMaps.jQuery(function () {
        var map = new YMaps.Map(YMaps.jQuery("#YMapsID")[0]);
        map.setCenter(new YMaps.GeoPoint(37.683383,55.764507), 14, YMaps.MapType.MAP);
        map.addControl(new YMaps.Zoom());
        map.addControl(new YMaps.ToolBar());
        map.addControl(new YMaps.TypeControl());

        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(37.683383,55.762571), "constructor#pmlbmPlacemark", "Офис продаж Дачи.ру"));
        
        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;
        }
    });			
	}
	
});



