/**
 * author: Frank Matuse <frank@extrastyle.de>
 */

var t = null;

var curr_bubble;
var over_bubble;

$(document).ready(function() {

    mainImg = $('#photoarea #imgbox img');
    mainImg.css({ position: 'absolute', top: 0, left: 0});
    if(mainImg.length > 1) {
        mainImg.css({ display: 'none'});
    }

    $('#newsticker > ul').newsticker();
    $('a.fancy').fancybox();

    curr_bubble = $('.cur_sub_nav');
    $('.cur_sub_nav').addClass('hideme');

    $('a.m').mouseover(function(){
        if($(this).not('.curr').length) {
            over_bubble = $(this).next().next();
        }
        $.clearMenuTimer();
        $('ul ul').hide();
        curr_bubble.hide();
        $(this).next().next().removeClass('hideme').show();
    });
    $('a.m').mouseout(function(){if($(this).not('.curr').length) $.setMenuTimer();});

    $('.bubble:not(".cur_sub_nav")').mouseover(function(){$.clearMenuTimer();});
    $('.bubble:not(".cur_sub_nav")').mouseout(function(){$.setMenuTimer();});

});

$.setMenuTimer = function() {t = window.setTimeout(function(){$('ul ul').hide();curr_bubble.fadeIn();}, 1000);};
$.clearMenuTimer = function() {window.clearTimeout(t);t = null;};