/**
 * Lance automatiquement un media au chargement de la page.
 */
var autolaunchMedia =
{
    /**
     * Affiche le media en fonction de l'url.
     */
    display: function()
    {
        url = location.href;
        if(url.match(new RegExp("(#v_[0-9]*)$", "g"))) // cas d'une video
        {
            var splitedStr = url.split(new RegExp("(_)+", "g"));
            var videoId = splitedStr[splitedStr.length-1];

            if(!isNaN(videoId)) { this.showVideo(videoId); }
        }

        return false;
    },

    /**
     * Affiche une video.
     */
    showVideo: function(videoId)
    {
        new Ajax.Updater('view_video',
                         '/film/video/show/' + videoId,
                         {asynchronous:true,
                          evalScripts:true,
                          onComplete:function(request, json){showModalDiv();$('view_video').show();}} );

        return false;
    }
}
