// cufon
Cufon.replace('.plumbc', {
	fontFamily: 'PlumbC',
	textTransform: 'uppercase'
});
Cufon.replace('.plumbc-sh', {
	fontFamily: 'PlumbC',
	textTransform: 'uppercase',
	textShadow: '1px 1px #000'
});
Cufon.replace('.plumbc-b, .read-more, .dl', {
	fontFamily: 'PlumbC-Bold',
	textTransform: 'uppercase'
});
Cufon.replace('.plumbc-b-hov', {
	fontFamily: 'PlumbC-Bold',
	textTransform: 'uppercase',
	hover: {
		color: '#ff5800'
	}
});
Cufon.replace('.plumbc-b-hov2', {
	fontFamily: 'PlumbC-Bold',
	textTransform: 'uppercase',
	hover: {
		color: '#818061'
	}
});
Cufon.replace('.plumbc-b-sh', {
	fontFamily: 'PlumbC-Bold',
	textTransform: 'uppercase',
	textShadow: '1px 1px #000'
});
Cufon.replace('.plumbc-b-gr', {
	fontFamily: 'PlumbC-Bold',
	textTransform: 'uppercase',
	textShadow: '1px 1px #000',
	color: '-linear-gradient(#fdfdfd, #c4c4c4)'
});
Cufon.replace('.plumbc-b-or', {
	fontFamily: 'PlumbC-Bold',
	textTransform: 'uppercase',
	textShadow: '1px 1px #000',
	color: '-linear-gradient(#ff5d08, #c94601)'
});

$(document).ready(function() {
	// input placeholder
	$('#q-search, #q-search-b').attr('placeholder', 'ПОИСК');
	$('#q-search, #q-search-b').placeholder();
	
	// top menu fix
	if (!$.browser.mozilla) {
		$('#top-menu').addClass('top-menu-fixed');
	}

	// last items border fix
	$('.b-entries .entry.short:last-child').css({ borderBottom: 'none' });
	$('.side-entries .b-entries:last-child').css({ marginBottom: 12 + 'px' });
	
	// column height equalizing
	$.fn.equalizeHeights = function() {
		return this.height(
			Math.max.apply(this, $(this).map(function(i, e) {
				return $(e).height();
			}).get())
		);
	};

	setTimeout(function() {
		$('.main-column:not([class~="main-column-index"]), .side-entries:not([class~="side-entries-index"])').equalizeHeights();
		$('.main-content-light').css('height', function() {
			return $(this).parent().height() - 48 + 'px';
		});
	}, 500);
	
	// news tape
	$('#news-tape .news-tabs').find('li.active').prev().addClass('before-active');

	// $('#news-tape').find('.news-tabs li a').click(function(e) {
	// 	e.preventDefault();
	//
	// 	if ($(this).parent().hasClass('active')) {
	// 		return;
	// 	} else {
	// 		$(this).parent().siblings().removeClass('active').removeClass('before-active');
	// 		if ($(this).parent().hasClass('before-active')) {
	// 			$(this).parent().removeClass('before-active');
	// 		}
	// 		$(this).parent().addClass('active');
	// 		if ($(this).parent().prev()) {
	// 			$(this).parent().prev().addClass('before-active');
	// 		}
	// 	}
	//
	// 	var listId = $(this).attr('rel');
	//
	// 	$(this).parents('.news-tabs').siblings('ul').hide();
	// 	$(this).parents('.news-tabs').siblings('#' + listId).show();
	// });

	// sharing hover
	$('#sharing .button').hover(function() {
		$(this).toggleClass('hover');
	});
});
