Event.observe(window, 'load', function()
{
    flowplayer(
        "video",
        "swf/flowplayer-3.1.3.swf",
        {
            clip: {
                url: 'videos/sushi_party.flv',
                title: 'Sushi Party',
                autoPlay: false,
                onFinish: function () {
                    this.stop();
                }
            },
            plugins:  {
                controls:  {
                    backgroundColor: '#000',
                    backgroundGradient: 'none',
                    all: false,
                    scrubber: true,
                    height: 40,
                    sliderColor: '#333333',
                    progressColor: '#121212',
                    bufferColor: '#666666'
                }
            },
            canvas: {
                backgroundColor: '#000',
                backgroundGradient: 'none',
                borderRadius: 10
            },
            screen: {
                width: 420,
                height: 315,
                top: 3
            }
        }
    );
    
    setTimeout(function() {
        $('retornos').hide();
    }, 1500);

    $$('form.frmContato input').each ( function (objLink)
    {
        if (objLink.type == 'text')
        {
            Event.observe(objLink, 'focus', function()
            {
                $(objLink).value = '';
            });
        }
    });

    Event.observe('ContatoConteudo', 'focus', function()
    {
        $('ContatoConteudo').value = '';
    });

    Event.observe( $('formContato'), 'submit', function(e)
    {
        var strMensagem = null;

        new Ajax.Request(
            'contato.php',
            {
                parameters:Form.serialize('formContato'),
                requestHeaders:['X-Update', 'retornos'],
                method:'post',
                asynchronous:true,
                evalScripts:true,
                onLoading: function()
                {
                    strMensagem  = '<b class="titulo">Aguarde</b>';
                    strMensagem += 'Enviando mensagem..';

                    $('retornos').show().update(strMensagem);
                },
                onComplete: function(t)
                {
                    strMensagem  = '<b class="titulo">Contato</b>';
                    strMensagem += t.responseText;

                    $('retornos').show().update(strMensagem);

                    setTimeout(function()
                    {
                        $('retornos').hide();
                    }, 2000);
                },
                onFailure: function()
                {
                    alert('Erro enviando mensagem.');
                }
            });

        Event.stop(e);

        return false;
    });
});
