function letGuybrushSpeak()
{
    var id = 'DasGekrakelDesOrakels';
    $(id).hide();
    $(id).update(sayings[sayingsIndex]);
    Effect.Appear(id, { duration: 1.0 });

    sayingsIndex++;
    if (sayingsIndex == sayings.length) {
        sayingsIndex = 0;
    }
}

Event.observe(window, 'dom:loaded', letGuybrushSpeak);


//Video announcement stuff ;-)
$('HangingGuybrush').observe('click', function(e)
{
    var goDown = $('HangingGuybrush').cumulativeOffset()[1] == -95;
    
    if (goDown)
    {
        new Effect.Move('HangingGuybrush', { x: 0, y: 95, mode: 'relative', queue: 'end' });
        Effect.Appear('GuybrushsVideoAnnouncement', { duration: .4, queue: 'end'  });

        var objectNode = new Element('object', {
            'width': 580,
            'height': 400
        });

        objectNode.appendChild(new Element('param', {
            'name':  'movie',
            'value': 'http://www.youtube.com/v/CdvITn5cAVc&hl=de&fs=1&rel=0'
        }));

        objectNode.appendChild(new Element('param', {
            'name':  'allowFullScreen',
            'value': 'true'
        }));

        objectNode.appendChild(new Element('param', {
            'name':  'allowscriptaccess',
            'value': 'always'
        }));

        objectNode.appendChild(new Element('embed', {
            'src':               'http://www.youtube.com/v/vvGpCMqZ358&hl=de&fs=1&',
            'type':              'application/x-shockwave-flash',
            'allowscriptaccess': 'always',
            'allowfullscreen':   'true',
            'width':             580,
            'height':            400
        }));

        $('GuybrushsVideoAnnouncement').appendChild(objectNode);
    }
    else
    {
        $('GuybrushsVideoAnnouncement').firstChild.parentNode.removeChild($('GuybrushsVideoAnnouncement').firstChild);
        Effect.Fade('GuybrushsVideoAnnouncement', { duration: .4, queue: 'end'  });
        new Effect.Move('HangingGuybrush', { x: 0, y: -95, mode: 'relative', queue: 'end' });
    }
});