/**
 * @author shevchenquot
 */

$(document).ready(function() {
	$('#mainmenu .mainmenu_elt').each(function(i) {
		$(this).find('.submenu').width($(this).width() - 2);
	
		$(this).mouseover(function() {
			if ($.browser.msie && parseInt($.browser.version) < 7) {
				$(this).height($(this).find('.submenu').height() + 27);
			} 
			else {
				$(this).stop().animate({
						height: $(this).find('.submenu').height() + 27
					}, {
						queue: false,
						duration: 400
					}, 'linear'
				);	
			}
			$(this).find('.mainmenu_elt_bg').stop().animate({
					width: $(this).find('.submenu').width() + 18
				}, {
					queue: false,
					duration: 400
				}, 'linear'
			);
		});
		
		$(this).mouseout(function() {
			if (!($.browser.msie && parseInt($.browser.version) < 7)) {
				$(this).stop().animate({
						height: '25px'
					}, {
						queue: false,
						duration: 400
					}, 'linear');
				
				$(this).find('.mainmenu_elt_bg').stop().animate({
						width: '25px'
					}, {
						queue: false,
						duration: 400
					}, 'linear');
			}
		});
	});
	
	$('.submenu').each(function(i) {
		$(this).find('li:first').css('border-top', 0);
	});
	
	if ($.browser.msie && parseInt($.browser.version) < 7) {
		$('#header').mouseover(function() {
			$('.mainmenu_elt').height('25px');
			$('.mainmenu_elt_bg').stop().animate({
					width: '25px'
				}, {
					queue: false,
					duration: 400
				}, 'linear');
		});
	}
});

