jQuery(function(){
  	jQuery('ul.menu-top, ul.menu-main').superfish({speed: 1});

    // Image-Rotation
    frontend.customRotateImages.timer = setTimeout(frontend.customRotateImages.rotate, frontend.customRotateImages.timeout);
    jQuery('#custom-image-rotation div').mouseover(frontend.customRotateImages.mouseOver);
    jQuery('#custom-image-rotation div').mouseout(frontend.customRotateImages.mouseOut);

});

frontend.customRotateImages = {}
frontend.customRotateImages.timer = null;
frontend.customRotateImages.timeout = 5000;
frontend.customRotateImages.rotate = function() {
    var active = jQuery('#custom-image-rotation div').not('.invisible');
    var next   = active.next('div');

    if (!next.length) {
        next = jQuery('#custom-image-rotation div:first');
    }

    active.addClass('invisible');
    next.removeClass('invisible');

    frontend.customRotateImages.timer = setTimeout(frontend.customRotateImages.rotate, frontend.customRotateImages.timeout);
}

frontend.customRotateImages.mouseOver = function() {
    clearTimeout(frontend.customRotateImages.timer);
}

frontend.customRotateImages.mouseOut = function() {
    frontend.customRotateImages.timer = setTimeout(frontend.customRotateImages.rotate, frontend.customRotateImages.timeout);
}