function yamaps() {
  if ($('#yamaps').length > 0) {

			var map = new YMaps.Map(YMaps.jQuery("#yamaps")[0]);
			map.setCenter(new YMaps.GeoPoint(37.631188,55.741385), 16, 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#pmpnmPlacemark", {
			    iconStyle : {
			        href : "http://api-maps.yandex.ru/i/0.3/placemarks/pmpnm.png",
			        size : new YMaps.Point(28,29),
			        offset: new YMaps.Point(-8,-27)
			    }
			});
		   map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(37.631236,55.741075), "constructor#pmpnmPlacemark", "Салон красоты Z'ART,<br /> Климентовский пер., д.2"));
			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;
			}
			map.redraw();
	}//if #yamaps
}
$(document).ready ( function() {

  $('div.servmenu>ul>li').hover (function () {
  	if ($(this).children('.submenu').length > 0) {
	  	$(this).addClass('active');
	  	$(this).children('.submenu').css('opacity',0).show().animate({opacity:1}, 400);
	  }
	},function(){
	  	$(this).children('.submenu').stop().animate({opacity:0}, 400).hide();
	  	$(this).removeClass('active');
	});
	
	//$('div.content hr').replaceWith('<div class="new" />');
	
	if ($('div.columnize').length > 0) {
		$('div.columnize').columnize({ columns: 2 })
	}
	
	if ($('#excl').length > 0 || $('.inpopup').length > 0) {
		$('#excl, .inpopup').click ( function() {
			if ($('#overlay').length == 0 ){
			    var over = '<div id="overlay"></div><div class="e_block"><div class="e_header"><h1>'+ $(this).text() +'</h1><span class="close">&times;</span></div><div class="content"></div></div>';
				$('body').append( over );
			}
			$('#overlay').css('display','block');
			$('div.e_header h1').text( $(this).text() );
			$('div.e_block div.content').html(" ");
			var url = "http://"+ location.host +$(this).attr('href');
	
			var jqxhr = $.get( url , function(data) {
			  $('div.e_block div.content').html(data);
			});

			jqxhr.error(function(e, textStatus, errorThrown) {
				$('div.e_header h1').text( textStatus +" ("+url+")");
				$('div.e_block div.content').html("<p>" + errorThrown + "</p>");
			});

			jqxhr.complete(function() {
				yamaps();
				var eBlockH = $('div.e_block').outerHeight();
				var eBlockW = $('div.e_block').outerWidth();
				var winH = $(window).height();
				var winW = $(window).width();
				if ( winH > eBlockH ) {
					var posTop = (winH - eBlockH) / 2;
					$('div.e_block').css('top',posTop+'px').css('width','570px').css('margin-left','-285px');
				} else {
					$('div.e_block div.content').columnize({ columns: 2 });
					var posTop = 50;
					var neh = winH - 600;
					var neWid = winW - 2 * posTop;
					if (neWid<winW*0.5){ neWid = winW*0.5; }
					var marL = 0-(neWid/2);
					//posTop = (winH - neh)/10;
					$('div.e_block').css('top',posTop+'px').css({'width':neWid+'px', 'height':neh+'px'}).css('margin-left',marL+'px');
					//$('div.e_block').css('top','50px').css('width','980px').css('margin-left','-490px');
				}
			});

			$('div.e_block').fadeIn();
			return false;
		});
		$('div.e_block span.close, #overlay').live("click", function() {
			$('div.e_block').fadeOut(300, function() {
				$(this).remove();
			});	
			$('#overlay').fadeOut(300, function() {
				$(this).remove();
			});	
			return false;
		});
	}

});//document.ready

