//jscrollpane
/*function getDiscount() {
 
	var heightDiscountBlock = $(".discountProgramBox .item").height();
	$(".newsBlockBox .scroll-pane").height(heightDiscountBlock);
	$(".newsBlockBox .item:first").addClass("firstNews");
	$('.scroll-pane').jScrollPane();
		
	// Выравниваем блоки по высоте на главной странице:
	var max_h = 0;
	$(".oneHeight_1").each(function() {
		var height = $(this).height();
		if (height > max_h) max_h = height; 
 	});
  $(".oneHeight_1").height(max_h+"px");	
}
*/
function getDiscount() {
 
	var heightDiscountBlock = $(".discountProgramBox").height();
	var heightDiscountBlockItem = $(".discountProgramBox .item").height();
	$(".newsBlockBox").height(heightDiscountBlock);
	$(".newsBlockBox .scroll-pane").height(heightDiscountBlockItem);
	$(".newsBlockBox .item:first").addClass("firstNews");
	$('.scroll-pane').jScrollPane();

}

//LOGOUT FORUM:
function log_out(B) {
	var A=document.getElementsByTagName("html")[0];
	A.style.filter="progid: DXImageTransform.Microsoft.BasicImage(grayscale=1)";
	if(confirm(B)) {
		return true
	}
	else {
		A.style.filter="";
		return false
	}
}

//Автоматическое подравнивание  высот e элементов
//Пример: $(selectors).autoHeight(function() {
// alert(1);
//});

$.fn.autoHeight = function(fn) {
	var height = 0;
	this.each(function() {
		var h = $(this).height(); 
		if (height < h) height = h;
	});
	
	this.each(function() {
		$(this).height(height);
	});
	
	if ($.isFunction(fn)) fn.call(this);
	
	return this;
}

function autoForumImageWidth() {
	var $image = $(".postbit .content img, .postbitlegacy .content img,.postbitdeleted .content img, .postbitignored .content img, .eventbit .content img");
	if ($(".sidebar_left").is(":visible")) {
		$image.css("maxWidth","800px");
	}
	else  {
		$image.css("maxWidth","600px");
	}
}
