    YMaps.jQuery(window).load(function () {
        var map = new YMaps.Map(YMaps.jQuery("#YMapsID-4036")[0]);
        map.setCenter(new YMaps.GeoPoint(34.23735,53.329474), 14, YMaps.MapType.MAP);
        map.addControl(new YMaps.Zoom());
        map.addControl(new YMaps.ToolBar());
		map.enableScrollZoom(true);	
        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 : "/i/flag32.png",
                size : new YMaps.Point(32, 32),
                offset: new YMaps.Point(-8,-27)
            }
        });

       map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(34.241456,53.328645), "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;
        }
    });

	YMaps.jQuery(window).load(function () {
        var map = new YMaps.Map(YMaps.jQuery("#YMapsID-1143")[0]);
        map.setCenter(new YMaps.GeoPoint(34.309915,53.299793), 15, 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 : "/i/flag32.png",
                size : new YMaps.Point(28,29),
                offset: new YMaps.Point(-8,-27)
            }
        });

       map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(34.309043,53.299304), "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;
        }
    });
	
    YMaps.jQuery(window).load(function () {
        var map = new YMaps.Map(YMaps.jQuery("#YMapsID-193")[0]);
        map.setCenter(new YMaps.GeoPoint(34.330397,53.240709), 15, 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 : "/i/flag32.png",
                size : new YMaps.Point(32,32),
                offset: new YMaps.Point(-8,-27)
            }
        });

       map.addOverlay(createObject("Placemark", new YMaps.GeoPoint(34.330129,53.240587), "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;
        }
    });	


function get_form(f, id) {
	if (!document.getElementById(id)&&(id!="")) {
		$.ajax({
			url: '/backend/get_form.php',
			async: false,
			data: 'f='+f+'&token='+$('#token').val(),
			success: function(result) {
				var elem=jQuery('<div>', {id: id, html: ''}).addClass('rshadow wp').appendTo('body');
				elem.css('display', 'none').html(result);				
				ml=Math.round(-elem.width()/2)+'px';
				mt=Math.round(-elem.height()/2)+'px';
				elem.css('marginLeft', ml).css('marginTop', mt);
				elem.toggle('slow');
			}
		}).responseText;
	} else $('#'+id).toggle('slow');
}
$(document).ready(function() {
	$('#ymap').click(function(){$('#YMapsID-1143').hide('slow'); $('#YMapsID-193').hide('slow'); $('#YMapsID-4036').toggle('slow')});
	$('#ymap2').click(function(){$('#YMapsID-4036').hide('slow'); $('#YMapsID-193').hide('slow'); $('#YMapsID-1143').toggle('slow')});
	$('#ymap3').click(function(){$('#YMapsID-4036').hide('slow'); $('#YMapsID-1143').hide('slow'); $('#YMapsID-193').toggle('slow')});
	
	$('html').bind('keypress', function(event) {
		if(event.keyCode==27) {//esc
			$('#YMapsID-4036').hide('slow');
			$('.close').parent().hide('slow');
		}
	});

	$('.clk').live('click', function() {if ($(this).val()==$(this).attr('def')) $(this).val('');});
	$('.clk').live('change', function() {if ($(this).val()=='') $(this).val($(this).attr('def'));});
	$('.clk').live('blur', function() {if ($(this).val()=='') $(this).val($(this).attr('def'));});

	$('.close').live('click', function(){$(this).parent().hide('slow')});
	
	$('#login .spoiler').click(function(){get_form('login_form', 'login_form');});
	$('#logout .spoiler').click(function(){get_form('logout_form', 'logout_form');});
	$('#feedback').click(function(){get_form('feedback_form', 'feedback_form');});
	$('#quest').click(function(){get_form('quest_form', 'quest_form');});

	//эмуляция отправки формы
	$('.submit').live('click', function(){
		$(this).closest('form').prepend('<input type="hidden" name="sb" value="'+$(this).attr('sbv')+'">').submit();
	});
	/*
	$('form').live('keypress', function(event) {
		if(event.keyCode==13) {//enter
			$(this).find('.submit').eq(0).trigger('click');
		}
	});
	*/
	$('input:password').live('keypress', function(event) {
		if($(this).closest('form').attr('class')=='subment'&&event.keyCode==13) {//enter
			$(this).closest('form').find('.submit').eq(0).trigger('click');
		}
	});	
	
	//вывод ошибки
	if(error!='') get_form('error_form', 'error_form');
	
	$('#thumb li').live('click', function(){
		$('#thumb li').removeClass('select');
		$(this).addClass('select');
		$('#thumb_i').attr('src', $('#thumb_i').attr('_src')+$(this).attr('i_id'));
	});
	
	get_cart();

	$('ul#flash_container').innerfade({
		speed: 4000,
		timeout: 4000,
		type: 'sequence',
		containerheight: '230px',
		children: ''
	});

});
function get_cart() {
	$.ajax({
		url: '/backend/cart.php',
		async: false,
		data: 'oper=show',
		success: function(result) {
			$('#scart').html(result);
		}
	}).responseText;	
}
function add(cat_id) {
	$.ajax({
		url: '/backend/cart.php',
		async: false,
		data: 'oper=add&cat_id='+cat_id,
		success: function(result) {
			$('#scart').html(result);
		}
	}).responseText;	
}
function addn(cat_id) {
	get_form('cnr_form', 'cnr_form');
}
function check_noreg() {
	$.ajax({
		url: '/backend/check_noreg.php',
		async: false,
		data: 'oper=check_noreg&u_fio='+$('#u_fio').val()+'&u_phone='+$('#u_phone').val()+'&u_kcaptcha='+$('#u_kcaptcha').val()+'&token='+$('#token').val(),
		success: function(result) {
			$('#cnr_form').submit();
		}
	}).responseText;
}
function check(field, obj) {
	if (field=='u_pass') {
		value=$('#u_pass1').val();
		value2=$('#u_pass2').val();
	} else {
		value=obj.value;
		value2="";
	}
	$.ajax({
		url: '/backend/check.php',
		async: false,
		data: 'field='+field+'&value='+value+'&value2='+value2+'&u_kcaptcha='+$('#u_kcaptcha').val()+'&token='+$('#token').val(),
		success: function(result) {
			if (result!='') {
				$('#'+field+'').show('slow');
			} else {
				$('#'+field+'').hide('slow');						
			}			
		}
	}).responseText;	
}
hs.registerOverlay({
	html: '<div class="closebutton" onclick="return hs.close(this)" title="Закрыть"></div>',
	position: 'top right',
	fade: 2
});
hs.graphicsDir = '/highslide/graphics/';
hs.wrapperClassName = 'borderless';
