   
function makeTall(){
    $(this).find('ul').fadeIn();
}

function makeShort(){
    $(this).find('ul').fadeOut();
}

$(document).ready(function(){
    $("#topBar li").hoverIntent(makeTall, makeShort);
    $("#mitarbeiter_wrap").append('<div id="text_ext"></div>');
    
    //Examples of how to assign the ColorBox event to elements
    $("a[rel='colorbox']").colorbox({iframe : true,  width:"720", height:"520"});
    $("a[rel='example2']").colorbox({transition:"fade"});
    $("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
    $("a[rel='example4']").colorbox({slideshow:true});
    $(".colorbox").colorbox({iframe : true,  width:"720", height:"520"});

    $("#click").click(function(){
        $('#click').css({"background-color":"#f00", "color":"#fff", "cursor":"inherit"}).text("Open this window again and this message will still be here.");
        return false;
    });
    
    $(".box_wrap").each(function(){
        
        $(this +'.text_container table tr').each(function(){
            $(this).find('td:first').addClass('first'); 
        });
        
        $(this).hover(function(){
            $(this).find('.image_container').addClass('display-show');            
        },function(){
            $(this).find('.image_container').removeClass('display-show');  
        });
        
        $(this).click(function(){
            if($(this).hasClass('clicked')){
            }else{
                $(this).parent().find('.clicked_box').removeClass('clicked_box');
                $(this).addClass('clicked_box');
                
                $("#text_ext").html('');
                $(this).find('.text_container').clone().appendTo('#text_ext');
            }
        })
    });
    
    $('.box_wrap').each(function()
    {
           var farben = new Array("color_1", "color_2", "color_3", "color_4", "color_5", "color_6");
           farben = shuffle(farben);
           
           $(this).addClass(farben[1]); 
    });
});

function shuffle(v){
    for(var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x);
    return v;
};
