// СѓРєР°Р·С‹РІР°РµС‚ С€РёСЂРёРЅСѓ РґР»СЏ Р±Р»РѕРєРѕРІ
function setWidthSubMenus() {
	jQuery.each($("#mainNavBox table td .subMenu"), function() {
		$(this).width($(this).parent().width());
    });
}

// СѓСЃС‚Р°РЅР°РІР»РёРІР°С‚СЊ РІС‹СЃРѕС‚Сѓ РѕС‚СЃС‚СѓРїР°
function setTopMarginSubMenus() {
	jQuery.each($("#mainNavBox table td .subMenu"), function() {
		$(this).css("margin-top","-"+($(this).parent().height()+7)+"px");
    });
}

var obj = null;

function checkHover() {
	if (obj) {
		obj.find('.subMenu').css("display", "none");
	}
}


// РІСЃРїР»С‹РІР°РЅРёРµ РІС‹РїР°РґР°СЋС‰РµРіРѕ РјРµРЅСЋ
function onHoverMenu() {
	$("#mainNavBox table td").hover(function() {
		if (obj) {
			obj.find('.subMenu').css("display", "none");
			obj = null;
		}

		$(this).find('.subMenu').css("display", "block");

	}, function() {
		obj = $(this);
		setTimeout("checkHover()",400);
	});
}

$(document).ready(function(){
    setWidthSubMenus();
    //setTopMarginSubMenus();
    onHoverMenu();
});

$(document).ready(function() {
    $("#secondNavBox ul ~ li").hover(function() {
        id = $(this).attr('id');
        id = id.replace("secondNavBoxItem","");
        id = id - 1;
        
        $(this).css("border-bottom","1px solid #ffffff");
        $("#secondNavBox ul #secondNavBoxItem"+id).css("border-bottom","1px solid #ffffff");

    }, function() {
        id = $(this).attr('id');
        id = id.replace("secondNavBoxItem","");
        id = id - 1;
        
        $(this).css("border-bottom","1px solid #e3e3e3");
        $("#secondNavBox ul #secondNavBoxItem"+id).css("border-bottom","1px solid #e3e3e3");
    });
});

