// establish a namespace for the landingpage if not defined yet (really bad)
if (!window.LandingPage)
{
// these values should be defined before including this script
window.LandingPage = {
header: '',
mediaplayer: '',
skin: '',
preview: '',
movie: '',
hqmovie: ''
};
}
/**
* return the inner size of the browser window, thanks for the snippet:
* @see http://www.howtocreate.co.uk/tutorials/javascript/browserwindow
* @return [width, height]
*/
LandingPage.windowSize = function ()
{
var w = 0, h = 0;
if (typeof(window.innerWidth) == 'number')
{
// Non-IE
w = window.innerWidth;
h = window.innerHeight;
}
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
{
// IE 6+ in 'standards compliant mode'
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
else if (document.body && (document.body.clientWidth || document.body.clientHeight))
{
//IE 4 compatible
w = document.body.clientWidth;
h = document.body.clientHeight;
}
return [w, h];
}
/**
* open an overlay with the big player and start playing hqmovie
*/
LandingPage.showFullscreenPlayer = function ()
{
if (document.getElementById && document.getElementById('landingpage-fullscreen-overlay'))
{
document.getElementById('landingpage-fullscreen-overlay').style.display = 'block';
document.getElementById('landingpage-fullscreen-container').style.display = 'block';
document.getElementById('landingpage-fullscreen-container').innerHTML =
'x\
';
this.windowOnResize = window.onresize;
window.onresize = LandingPage.adjustPosition;
LandingPage.adjustPosition();
return true;
}
return false;
}
/**
* closes the overlay and destroys content
*/
LandingPage.destroyFullscreenPlayer = function ()
{
if (document.getElementById && document.getElementById('landingpage-fullscreen-overlay'))
{
document.getElementById('landingpage-fullscreen-overlay').style.display = 'none';
document.getElementById('landingpage-fullscreen-container').style.display = 'none';
document.getElementById('landingpage-fullscreen-container').innerHTML = "";
if (this.windowOnResize)
{
window.onresize = this.windowOnResize;
}
}
return false;
}
LandingPage.adjustPosition = function ()
{
if (document.getElementById && document.getElementById('landingpage-fullscreen-overlay'))
{
var size = LandingPage.windowSize();
document.getElementById('landingpage-fullscreen-overlay').style.width = size[0] + "px";
document.getElementById('landingpage-fullscreen-overlay').style.height = size[1] + "px";
document.getElementById('landingpage-fullscreen-container').style.left = Math.floor(parseInt(size[0] - 850) / 2) + "px";
document.getElementById('landingpage-fullscreen-container').style.top = "100px";
return true;
}
}
// register swfobject to onload event
// initialize the swfs
swfobject.embedSWF(
LandingPage.header,
"landingpage-movie",
"978", "298", "9.0.28",
false,
{
movie: LandingPage.movie,
skin: LandingPage.skin,
preview: LandingPage.preview
},
{ menu: "false", scale: "noScale", allowFullScreen: "false", allowScriptAccess: "true", wmode: "opaque" },
{ id: 'landingpage-movie' }
);