$(document).ready(function(){
    show_menu = function(e){
        $("ul.menu-top-2").slideDown(100)
    }
    hide_menu = function(e){
        $("ul.menu-top-2").slideUp(300)
    }
    hover_cfg = {
        interval: 500,
        sensitivity: 4,
        over: show_menu,
        out: hide_menu,
        timeout: 500
    }
    $("#menu").hoverIntent(hover_cfg)
    
    // no borders for links with images inside - that's ugly
    $("a:has(img)").addClass("nb");
    
    // $("a.btn").click(function(){return false})
    // $("div.panes").css('height', $("div.panes").height())
    
    $("a.link-menu-open").click(function(){
        target = $(this).attr("rel")
        $(target).slideToggle(300)
        if (!$(this).attr("open")) {
            $(this).attr("open", $(this).text())
            $(this).text($(this).attr("toggletext"))
            $(this).addClass("arrow-R")
            $(this).removeClass("arrow-L")
        }
        else {
            $(this).text($(this).attr("open"))
            $(this).addClass("arrow-L")
            $(this).removeClass("arrow-R")
            $(this).attr("open", "")
        }
        
        return false
    })
    
    $("ul.menu-split-3").each(function(){
        breakColumns2($(this), 3, "last", "append-1");        
    })

    // breakColumns2("ul.menu-2", 3, "last")

    $("ul.lecturers li").click(function(){
        window.location = $(this).find('a').attr('href')
    })

    $("a.events-more").click(function(){
        url = $(this).attr('rel')
        prepend_to = $(this).attr('prepend')
        $.get(url, function(data) {
            $(prepend_to).before(data);
            $('.events-new').slideDown()
        });
        return false
    })
    // removing the default class on divs containing upcoming events on a main page
    $('.events-new').removeClass('events-new')
})