﻿
$(document).ready(function () {

    $(".menul1 a.haschildren").click(function () {
        var menu = $(".menu");
        var dropmenu = $(this).next();

        if (menu.hasClass("expanded"))
            menu.removeClass("expanded").css({ height: "auto" });

        if (dropmenu.hasClass("l2open"))
            dropmenu.removeClass("l2open").css({ top: "auto" });
        else {
            $(".l2open").removeClass("l2open").css({ top: "auto" });
            dropmenu.css({ top: menu.height() - 3 + "px" }).toggleClass("l2open");
            menu.addClass("expanded").css({ height: (dropmenu.height() + menu.height() + 10) + "px" });
        }

        return false;
    });

// Borttagen då annonser från Widespace inte visades vid alla sidvisningar 2012-01-04 (Mikael Lundin)
//    // ta bort icke befintliga annonser
//    $(".adbox").each(function () {
//        if ($(this).height() < 20) {
//            $(this).remove();
//        }
//    });

    setTimeout(function () {
        $("a.getmore").click(function () {
            var n = 0;
            var els = $(this).parent().children(".hidden:lt(3)");
            els.show(500, function () {
                $(this).removeClass("hidden");
                n++;
            });
            if (els.length == 0)
                $(this).hide(500);
            return false;
        });
    }, 1);
});


