window.onresize = scaleFlashMovie;
function scaleFlashMovie()
{
    if (document.getElementById)
    {
        var tweet_mov = document.getElementById ("tweetMov");
        if (tweet_mov)
        {
            var tweet_size = tweetSize();
            tweet_mov.width = tweet_size[0];
            tweet_mov.height = tweet_size[1];
        }
        return true;
    }
    return false;
}

// Scale the box containing the flash movie
function tweetSize()
{
    var tweet_width = 192;
    var tweet_height = 59;

    if (document.getElementById)
    {
        var tweet = document.getElementById ("tweet");
        if (tweet)
        {
            // Set size in ems - use to measure the desired size -
            // then divide by double the golden ratio
            tweet_width = tweet.offsetWidth;
            tweet_height = Math.round (2.0 * tweet_width / (Math.sqrt (5) + 1));
            tweet.style.height = "" + tweet_height + "px";
        }
    }
    return [tweet_width, tweet_height];
}



// Write the flash code
var tweet_size = tweetSize();
var flash_embed = new FlashEmbed();

// We target the Flash 9 player (actionscript 3)
flash_embed.initDetect (9);

flash_embed.addQueryParam ("logging");
//flash_embed.addQueryParam ("conf_file");
flash_embed.addParam ("conf_file", "/tweet/Tweet.conf");
flash_embed.addQueryParam ("tweet_file");

flash_embed.doEmbed
(
    "/tweet/Tweets.swf",
    tweet_size[0],
    tweet_size[1],
    "#ffffff", // 
    "tweetMov" // Make sure it matches the 'scaleFlashMovie' function above
);
