//window.onload = function(){ alert("welcome"); }

$(document).ready(function()
{
    // Menu

    /* Hover a всех уровней */
    $("#nav a").hover(function()
    {
        $(this).children(".one").addClass('one_hover');
        $(this).children(".two").addClass('two_hover');
        $(this).children(".three").addClass('three_hover');
    },
    function()
    {
        $(this).children(".one").removeClass('one_hover');
        $(this).children(".two").removeClass('two_hover');
        $(this).children(".three").removeClass('three_hover');
    });

    /* Активный родитель 1-го уровня */
    $("#nav .nav_2").hover(function()
    {
        $(this).parents(".level_1").children("a").children(".one").addClass('one_hover');
        $(this).parents(".level_1").children("a").children(".two").addClass('two_hover');
        $(this).parents(".level_1").children("a").children(".three").addClass('three_hover');
    },
    function()
    {
        $(this).parents(".level_1").children("a").children(".one").removeClass('one_hover');
        $(this).parents(".level_1").children("a").children(".two").removeClass('two_hover');
        $(this).parents(".level_1").children("a").children(".three").removeClass('three_hover');
    });

    /* Активный родитель 2-го уровня */
    $("#nav .nav_3").hover(function()
    {
        $(this).parents(".level_2").children("a").children(".one").addClass('one_hover');
        $(this).parents(".level_2").children("a").children(".two").addClass('two_hover');
        $(this).parents(".level_2").children("a").children(".three").addClass('three_hover');
    },
    function()
    {
        $(this).parents(".level_2").children("a").children(".one").removeClass('one_hover');
        $(this).parents(".level_2").children("a").children(".two").removeClass('two_hover');
        $(this).parents(".level_2").children("a").children(".three").removeClass('three_hover');
    });


    var shadow=$('#shadow').height()+90;

    if(shadow>$("#filling").height()+75)
    {
        $("#right .col_right").height(shadow);
        $("#right").height(shadow);
    }



    // Высота правой колонки до футера    при изменении размера окна
    $(window).bind("resize", function()
    {
        var shadow=$('#shadow').height()+90;
        if(shadow>=$("#filling").height()+75)
        {
            $("#right .col_right").height(shadow);
            $("#right").height(shadow);
        }
    });

    // Min-height для центра с тенью
    var filling_hight=$("#filling").height()-90;
    if ($("#center").height()<(filling_hight))
        $("#center").css("min-height",filling_hight);

});



window.onload=function()
{
    var shadow=$('#shadow').height()+90;
    if(shadow>$("#filling").height()+75)
    {
        $("#right .col_right").height(shadow);
        $("#right").height(shadow);
    }

    // Min-height для центра с тенью
    var filling_hight=$("#filling").height()-90;
    if ($("#center").height()<(filling_hight))
        $("#center").css("height",filling_hight);
}
