This is a continuation of
another thread but as the subject of the problem is now completely different, I decided it best to start another.
The code below loads a home page and (providing a cookie is not present) it loads a fullscreen black div with a container for a very short flash 'intro'. The Div then auto-closes after 4 seconds and therefore allows the flash to finish (as I couldn't find a way of linking the video end event to the closure of the div.) This is also quite good as it means that if there is a massive delay in the loading of the page, the video ends up not playing at all and so great for slow connections.
So, the problem, well for some reason, the black div seems to load after the rest of the page, particularly in Opera and Safari but sometimes in FF as well. This makes it look like you are being diverted away from the site just to watch a stupid 2.2 second video whereas I want it to seem like a small video to watch while the rest of the page loads behind.......?
I have just included the bottom part of the head and the top part of the body; and missed out the actual flash call for simplicity: Code:
<script type="text/javascript">
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
function setTheDivStyle() {
if(!readCookie('foxIndex')) {
// if cookie not found display the div and create the cookie
document.getElementById("splash").style.display="block";
createCookie('foxIndex', 'foxIndex', 24); // 1 day = 24 hours persistence
}
else {
// if cookie found hide the div
document.getElementById("splash").style.display="none";
}
}
</script>
<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
</head>
<body onload = "setTheDivStyle()">
<div id="splash">
<div id="vid">
<script>
</script>
</div>
</div>
<script type="text/javascript">
function closeSplashDiv(){
document.getElementById("splash").style.display=" none";
}
// close the div in 4 secs
window.setTimeout( closeSplashDiv, 4000 );
</script>
<div id="container">.....................etc