// Functions for toggling 'Overlay' display items

function getFlashMovie(movieName) {
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    return (isIE) ? window[movieName] : document[movieName];
}


function showOverlay() {	
	
	// Show overlay
	var overlay = document.createElement('div');
	overlay.id = 'overlay';
	overlay.innerHTML = '<div id="overlay-flash">' +
		'<video id="html5-video" width="576" height="324" poster="media/video/ProdentFS_review.jpg" autoplay="true" controls="controls">' +
		'<source src="media/video/Prodent_576x324.mp4" />' +
		'<source src="media/video/Prodent_320x180.mp4" />' +
		'<object id="flash_fallback" width="576" height="324" type="application/x-shockwave-flash" data="media/video/player.swf">' +
        '<param name="movie" value="media/video/player.swf" />' +
      	'</object>' +
		'</video>' +
		'<a href="javascript:hideOverlay();">Close Video</a>'
		'</div>';
	document.body.insertBefore(overlay, document.body.firstChild);
	
	// Scroll page to top in IE6
	if (Browser.Engine.trident4) {
		window.scrollTo(0,0);
	}	
}

function hideOverlay() {
	
	// Remove overlay
	var flash = document.getElementById('overlay-flash');	
	var overlay = document.getElementById('overlay');
	if (overlay && flash) overlay.removeChild(flash);	
	if (overlay) document.body.removeChild(overlay);	
}


