﻿$(document).ready(function () {

    //LAYOUT



    // MENU MAIN

    $("#MainMenuArea>ul>li a")
    .mouseover(function () {
        $sm = $(this).next('ul:hidden');
        $sm.removeAttr('style');
        $p = $(this).position().left;
        $r = $p + $sm.outerWidth();

        $d = parseInt($r - parseInt($('#Page').width() + $('#Page').position().left));
        $td = $d;
        if ($d > 0) $sm.css('margin-left', '-' + $d + 'px');
        $(this).next('ul:hidden').slideDown(100)
    })
    .mouseout(function () {
        $(this).next('ul:visible').stop().hide();
    })
    $("#MainMenuArea>ul>li>ul")
    .mouseover(function () {
        $(this).stop().show();
        $(this).prev('a').addClass('hover');
    })
    .mouseout(function () {
        $(this).hide();
        $(this).prev('a').removeClass('hover');
    })

    //  MENU LANG

    $(".LangSwitch").after('<div class="LangIndicator"><a href="#" class="SelectArrow">&nbsp;</a></div>');
    $(".LangSwitch .selected a").clone().appendTo($('.LangIndicator'));
    function langToggle(e) {
        $(".LangSwitch").slideToggle('fast', function () {
            if ($(".LangSwitch").is(':visible')) $('.LangIndicator a.SelectArrow').css('background-image', 'url("/Templates/Public/Styles/Infopulse/img/arr-top.jpg")');
            else $('.LangIndicator a.SelectArrow').removeAttr('style');
        });
        e.blur();
        return false;
    }
    $('.LangIndicator a').click(function () { return langToggle($(this)) });

    // DELETE LICENSE WARNING
    $("div[style*='z-index: 99999999'][style*='position: absolute']").hide();

});
