var general_config = {src:'/blog/wp-content/themes/babysleepssafe/flash/video/FlowPlayerDark.swf', width: /*425*/ 750, height: /*344*/ 630};
var tvspot_config  = {config: {autoPlay: true, autoBuffering: true, initialScale: 'scale', controlBarGloss: 'none', showMenu: false, showFullScreenButton: false, videoFile: '/blog/wp-content/themes/babysleepssafe/flash/video/TV_Spot_FINAL_22508.flv'}};
var shu_config  = {config: {autoPlay: true, autoBuffering: true, initialScale: 'scale', controlBarGloss: 'none', showMenu: false, showFullScreenButton: false, videoFile: '/blog/wp-content/themes/babysleepssafe/flash/video/dr-shu.flv'}};
//var shu_config  = {config: {autoPlay: true, autoBuffering: true, initialScale: 'scale', controlBarGloss: 'none', showMenu: false, showFullScreenButton: false, videoFile: '/blog/wp-content/themes/babysleepssafe/flash/video/baby-sleeps-safe.flv'}};
var vicki_config  = {config: {autoPlay: true, autoBuffering: true, initialScale: 'scale', controlBarGloss: 'none', showMenu: false, showFullScreenButton: false, videoFile: '/blog/wp-content/themes/babysleepssafe/flash/video/Dr_Vicki_FINAL.flv'}};
var demo_config  = {config: {autoPlay: true, autoBuffering: true, initialScale: 'scale', controlBarGloss: 'none', showMenu: false, showFullScreenButton: false, videoFile: '/blog/wp-content/themes/babysleepssafe/flash/video/Demo_Video_for_Web_v5.flv'}};

/*****************************************************************************/


// F. Permadi May 2000
function getFlashMovieObject(movieName) {
    if (window.document[movieName]) {
        return window.document[movieName];
    }
    
    if (navigator.appName.indexOf("Microsoft Internet")==-1) {
        if (document.embeds && document.embeds[movieName])
        return document.embeds[movieName];
    }
    else {
        return document.getElementById(movieName);
    }
}


function showVideo(hwnd) {
	
	var content_flash = getFlashMovieObject('content_flash');
	if (content_flash) {
	    content_flash.StopPlay();
	}
	
	var header_flash = getFlashMovieObject('header_flash');
	if (header_flash) {
	    header_flash.StopPlay();
	}
	
	
	var heightNew = 670;
	var widthNew  = 750;

	if (hwnd == 'tvspot') {
	   general_config["height"] = 430;
	   heightNew = 460;	  	   
	}
	else {
	   general_config["height"] = 630;
	   heightNew = 660;	   
	}



	var tmp_arrayPageScroll = document.viewport.getScrollOffsets();
	var tmp_Top = parseInt(tmp_arrayPageScroll[1] + ((undefined == window.innerHeight ? document.viewport.getHeight() : window.innerHeight) - heightNew) / 2);
	var tmp_Left = parseInt(tmp_arrayPageScroll[0] + ((undefined == window.innerWidth ? document.viewport.getWidth() : window.innerWidth) - widthNew) / 2);

	with (document.getElementById(hwnd).style) {		
		left = tmp_Left + 'px';
		top = tmp_Top + 'px';
		display = "block";
		height = heightNew-20 + 'px';
	}

	flashembed(hwnd + "_vidwindow", general_config, eval(hwnd + "_config"));
}

function closeVideo(hwnd){
	//document.getElementById(hwnd + "_vidwindow").innerHTML = "";
	
	var content_flash = getFlashMovieObject('content_flash');
	if (content_flash) {
	    content_flash.Play();
	}

	var header_flash = getFlashMovieObject('header_flash');
	if (header_flash) {
	    header_flash.Play();
	}
	
	
	document.getElementById(hwnd).style.display = "none";
}

/*****************************************************************************/

function openProd() {

	var heightNew = 500;
	var widthNew = 400;
	
	var tmp_arrayPageScroll = document.viewport.getScrollOffsets();
	var tmp_Top = tmp_arrayPageScroll[1] + ((undefined == window.innerHeight ? document.viewport.getHeight() : window.innerHeight) - heightNew) / 2;
	var tmp_Left = (tmp_arrayPageScroll[0]) + ((undefined == window.innerWidth ? document.viewport.getWidth() : window.innerWidth) - widthNew) / 2;
	document.getElementById("prod").style.left = tmp_Left + 'px';
	document.getElementById("prod").style.top = tmp_Top + 'px';
	document.getElementById("prod").style.display = 'block';
}

function closeProd() {
	document.getElementById("prod").style.display = 'none';	
}