window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init);

function so_init()
{
	if($.browser.msie)
	{
		//correctPNG(); // oughtrock вот эьа строка косячила расстояние между значками и гербами
	}
	$('.c .gallery .block .img').jMDCorrectHeight();
	$('.c .gallery .block').jMDCorrectHeight();
	
	// Наведение на карту
	$('.map .map1, .legend .map1_href').hover(function(){
		$('.map .map1').addClass('active1');
	}, function(){
		$('.map .map1').removeClass('active1');
	});
	$('.map .map2, .legend .map2_href').hover(function(){
		$('.map .map2').addClass('active2');
	}, function(){
		$('.map .map2').removeClass('active2');
	});
	$('.map .map3, .legend .map3_href').hover(function(){
		$('.map .map3').addClass('active3');
	}, function(){
		$('.map .map3').removeClass('active3');
	});
	$('.map .map4, .legend .map4_href').hover(function(){
		$('.map .map4').addClass('active4');
	}, function(){
		$('.map .map4').removeClass('active4');
	});
	$('.map .map5, .legend .map5_href').hover(function(){
		$('.map .map5').addClass('active5');
	}, function(){
		$('.map .map5').removeClass('active5');
	});
	$('.map .map6, .legend .map6_href').hover(function(){
		$('.map .map6').addClass('active6');
	}, function(){
		$('.map .map6').removeClass('active6');
	});
	$('.map .map7, .legend .map7_href').hover(function(){
		$('.map .map7').addClass('active7');
	}, function(){
		$('.map .map7').removeClass('active7');
	});
}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 or higher.
{
	for(var i=0; i<document.images.length; i++)
	{
		var img = document.images[i]
		var imgName = img.src.toUpperCase()
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
		{
			var imgID = (img.id) ? "id='" + img.id + "' " : ""
			var imgClass = (img.className) ? "class='" + img.className + "' " : ""
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
			var imgStyle = "display:inline-block;" + img.style.cssText
			if (img.align == "left") imgStyle = "float:left;" + imgStyle
			if (img.align == "right") imgStyle = "float:right;" + imgStyle
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
			var strNewHTML = "<span " + imgID + imgClass + imgTitle
			+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
			+ " filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
			+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
			img.outerHTML = strNewHTML
			i = i-1
		}
	}
}

function ShowBann (path, w, h)
{
	window.open(path,'ShowBann','width='+w+',height='+h+',status=no,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes,top='+ Math.round((screen.height/2)-(h/2)) +',left=' + Math.round((screen.width/2)-(w/2)));
}
