// фиксит баги в каталоге для IE
function fixCatalogTooltip() {
	if ($("ul.catalog").size() > 0) {
		$("ul.catalog li").hover(function(){
			$(this).css("z-index", "2");
		},function(){
			$(this).css("z-index", "1");
		});
		$("ul.catalog div.pic").hover(function(){
			$(this).addClass("jshover");
		},function(){
			$(this).removeClass("jshover");
		});
	}
}

// показать/спрятать регистрацию
function showRegistration () {
	if ($("#registration").size() > 0) {
		var shadowHeight=$("#wrap").height();
		$("#shadow").height(shadowHeight).show();
		$("#registration").show();
	}
	return false;
}
function hideRegistration () {
	if ($("#registration").size() > 0) {
		$("#shadow").hide();
		$("#registration").hide();
	}
	return false;
}

function initSccrollH (current) {
	var total = 0;
	$(current).find("li").each(function(i){total += 159;});
	$(current).find("ul").width(total);
	$(current).jScrollHorizontalPane({showArrows:true, scrollbarHeight: 11, arrowSize: 11});
}

function reloadPage() {
	$("body").css("display","inline").css("display","block");
}

$(document).ready(function(){
	if ($.browser.msie) {fixCatalogTooltip();};
	$(".scroll").each(function() {$(".scroll").jScrollPane({showArrows:true, scrollbarWidth: 11});});

	$(".scrollh").each(function() {if ($(".scrollh").parent('.section').css("display")=="block") {initSccrollH(this);}});

	$("p.section-title").each(function() {
		$(this).click(function(){
			$(this).toggleClass("expanded");
			if ($.browser.msie) {$(this).next(".section").toggle();}
			else {$(this).next(".section").slideToggle(250,function(){reloadPage();});}
			if ($(this).next(".section").not(".hidden")) {initSccrollH($(this).next(".section").find(".scrollh"));}
			reloadPage();
		});
	});
	if ($(".slider").size() > 0) {m1SliderInit();}
	if ($("#tabs").size() > 0) {$('#tabs').tabs({
		fxFade: true,
		fxSpeed: 'fast',
		onHide: function() {
			reloadPage();
		}
	});}
	reloadPage();
})