I am a newbie to Javascript and am a little overwhelmed. I am trying to make a website where one clicks on a button, starting a .flv movie of someone breaking open a fortune and holding the fortune up to the camera and randomly chosen sentences sent by Javascript appearing over the white piece of paper. So far it does jack except for show a button and the movie without playing. When the button is pressed, nothing happens.

<html>
<head><title>Fortune Cookie</title>

<style type="text/css">

body {
background-color: white;
color: black;
text-align: center;
font-size: 17px;
}

#center_wrapper {
margin-right: auto;
margin-left:auto;
width: 720px;
}

#center_wrapper2 {
margin-right: auto;
margin-left: auto;
width: 350px;
display: block;
}

#pos_fortune {
position: absolute;
top: 280px;
z-index:1;
width: 350px;

</style>
</head>

<body style="text-align: center">
<div id="center_wrapper">



<img src="fortune_title.gif" style="position: relative; top: 10px" />


<!-- embeds video of fortune cookie breaking -->
<div style="position:absolute; top: 160px; z-index:0">

<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" width="720" height="480" id="FLVPlayer">
<param name="movie" value="FLVPlayer_Progressive.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="FlashVars" value="&amp;MM_ComponentVersion=1&amp;skinName=Clear_Skin_1&amp;streamName=coo kie&amp;autoPlay=false&amp;autoRewind=true" />
<param name="swfversion" value="8,0,0,0" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you donít want users to see the prompt. -->
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="FLVPlayer_Progressive.swf" width="720" height="480">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="scale" value="noscale" />
<param name="salign" value="lt" />
<param name="FlashVars" value="&amp;MM_ComponentVersion=1&amp;skinName=Clear_Skin_1&amp;streamName=coo kie&amp;autoPlay=true&amp;autoRewind=true" />
<param name="swfversion" value="8,0,0,0" />
<param name="expressinstall" value="Scripts/expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
<h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
<p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a></p>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>



<div id="center_wrapper2">

<SCRIPT LANGUAGE="JavaScript">

<!-- switch statement that chooses fortune -->
function choose_fortune()
{
var fortune;
var rand_no = Math.ceil(2*Math.random());
alert(rand_no);
switch(rand_no)
{
case 1:
fortune = 'This this1.';
break;
case 2:
fortune = 'This this2.';
break;
default:
fortune = 'This this3.';
}

document.write("<div id=\"pos_fortune\">");
document.write(fortune);
document.write("</div>");

}


//code lifted from http://www.permadi.com/tutorial/flashGetObject/, tries different methods of accessing video, don't know if should use cookie (the file name of the .flv) or "FLVPlayer" (the id from the object code)
function getFlashMovieObject("FLVPlayer")
{
if (window.document["FLVPlayer"])
{
return window.document["FLVPlayer"];
}
if (navigator.appName.indexOf("Microsoft Internet")==-1)
{
if (document.embeds && document.embeds["FLVPlayer"])
return document.embeds["FLVPlayer"];
}
else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
{
return document.getElementById("FLVPlayer");
}
}


function display_fortune()
{
getFlashMovieObject("FLVPlayer").play();
setTimeout('choose_fortune()', 5000); //after 5 seconds, switch statement output shows up where fortune in fortune cookie is

}

</script>

<input type="button" value="Open Fortune Cookie!" onclick="display_fortune()" /> <!--button that starts whole process by playing movie and starting timer for text appearance -->



</div>
</div>
</div>


</body>

</html>

Major problems: The div formatting of the chosen fortune doesn't work. I also need to use something besides document.write() since it clears the page when it shows the text.

I am not sure how to make the movie play using Javascript. I was half guessing based on some stuff I read on the web, and it doesn't work.

Also, is there a way to get rid of the Flash play and stop, etc., buttons or tie them to Javascript?

The video also moves way to the right in IE instead of being centered.

Thanks in advance for any help or taking the time to read this.