function footer_menu_up()
{

    if( $(".FooterNavItem .underlined").next().size() == 0 || $(".FooterNavItem .underlined").next() == null || $(".FooterNavItem .underlined").next() == undefined)
    {
        $(".FooterNavItem .root-item:first").addClass("underlined");

    }
    else
    {
        $(".FooterNavItem .underlined").removeClass("underlined").next().addClass("underlined");

    }
}

$(document).ready(function(){

    if(location.href=="http://www.bwt.ru/" || location.href=="http://www.bwt.ru/index.php" || location.href=="http://bwt.ru/" || location.href=="http://bwt.ru/index.php"){
        $('#_ctl0_cnt_SideTab_RadEditorPlaceHolderControl2').append('<div class="order_form_link"><br/><a href="/order_form/">Заполнить анкету на водоподготовку в доме</a><br/><br/></div>');
    };
    setInterval(footer_menu_up, 5000);
    $('.MainNav ul:first li:nth-child(3)').addClass('upmenu-four');
    $('.MainNav ul:first li:nth-child(2)').addClass('upmenu-four');
    $('.MainNav ul:first li:nth-child(4)').addClass('upmenu-four-');
    $('.MainNav ul:first li:nth-child(4)').addClass('upmenu-four');
    $('.MainNav > ul:last').addClass('upmenubot');
    $('.upmenubot li:nth-child(4)').addClass('upmenubot-last');


    var uw, umbli, nw, sw;
    $('.MainNav > ul').each(function(i,e){
        uw = $(e).width();

        umbli = $(e).children('li').length;

        sw = 0;

        $(e).children('li:last-child').addClass('menu-last-child');

        $(e).children('li').each(function(){
            sw += $(this).width();
        });

        sw = uw - sw;

        sw /= 8;

        $(e).children('li').css('padding','0 '+ sw + 'px');
    });

})
