$(document).ready(function(){
	$('.dropdown .dropdown-short a').click(function(){
		if ($(this).parents('.dropdown-block').find('.dropdown-full').length) {
			$(this).parents('.dropdown-block').find('.dropdown-full').toggle();
			return false;
		}
	})
	
	$('.zaprosi-block .dash').click(function(){
		chatTop = $(this).position().top - 43;
		$('.chat').css({'top':chatTop}).show();
		return false;
	})
	
	$('.chat .close').click(function(){
		$(this).parents('.chat').hide();
		return false;
	})
	
	$('ul.news li a').click(function(){
		activeNum = $(this).parents('ul').eq(0).find('li').index($(this).parents('li').eq(0));
		$(this).parents('li').siblings().removeClass('active');
		$(this).parents('li').addClass('active');
		$('.big-news div').eq(activeNum).addClass('active').siblings().removeClass('active');
		return false;
	})
	
	emulateMinWidth = function(){
		$('.dropdown-full').each(function(){
			newWidth = Math.max($(this).prev().outerWidth(true), $(this).width());
			$(this).css({'width': newWidth});
		})
	}
	
	getColsWidth = function (){
		newHeight = Math.max(parseInt($('.main-col .border-block').height()),parseInt($('.right-col .border-block').height()));
		$('.main-col .border-block, .right-col .border-block').css({'height': newHeight+10+'px'});
	}
	
	if ($.browser.msie && $.browser.version < 7){
		emulateMinWidth();
	}
	getColsWidth();
	
	$('.search-block .i-text').focus();
	
	
})

$(document).click(function(e){
    if ($(e.target).parents().filter('.dropdown-full:visible').length != 1) {
        $('.dropdown-full').hide();
    }
});
