$('html').addClass('has_js');

function slideshow(){

    //remove all other formatting besides img tags
    $('#slideshow #slideshow-content img').appendTo('#slideshow-content');
    $('#slideshow #slideshow-content').children().not('img').remove();

    if ($('#slideshow img').length > 1){
        $('#slideshow img:gt(0)').hide();
        t = setInterval(function(){
            $('#slideshow img:first-child').fadeOut('slow')
            .next('img').fadeIn('slow')
            .end().appendTo('#slideshow #slideshow-content');
        },
        3000);
    }
}

$.fn.DDMenu = function(options) {

    var defaults = {
        slideDownSpeed : 150,
        slideUpSpeed : 150,
        hoverClass : 'sfhover',
        delaySpeed : 500
    };

    return this.each(function() {

        // initial variables
        var opts = $.extend(defaults, options), t = '', $menu = $(this), menu_width = $menu.width();

        $menu.children('ul').width(menu_width).children('li').width(menu_width);

        $menu.hover(function() {

            $menu.siblings().not('.' + opts.hoverClass).children('ul')
            .slideUp(opts.slideUpSpeed);

            clearTimeout(t);

            $menu.addClass(opts.hoverClass).children('ul').slideDown(
                opts.slideDownSpeed);

        }, function() {

            $menu.removeClass(opts.hoverClass);

            t = setTimeout(function() {
                $menu.children('ul').slideUp(opts.slideUpSpeed);
            }, opts.delaySpeed);

        });

    });

};

$(document).ready(function(){
    // drop down menu
    $('#nav > li').DDMenu();
    slideshow();
    $('#entry-points li').eq(1).addClass('second');
    $('#entry-points li').eq(2).addClass('third');

    $('.innerfade').innerfade({
        speed: 'slow',
        timeout: 4000,
        type: 'sequence',
        containerheight: '90px'
    });

    $('.page-id-78 #article #page-content ul > li:odd').addClass('odd');
    $('.page-id-78 #article #page-content ul > li:last-child').addClass('last');

});
