/*
* Functions for use on vondu.dk
*/

function getBrowserWidth(){
			    if (window.innerWidth){
			        return window.innerWidth;}  
			    else if (document.documentElement && document.documentElement.clientWidth != 0){
			        return document.documentElement.clientWidth;    }
			    else if (document.body){return document.body.clientWidth;}      
			        return 0;
			}
function getBrowserHeight(){
			    if (window.innerHeight){
			        return window.innerHeight;}  
			    else if (document.documentElement && document.documentElement.clientHeight != 0){
			        return document.documentElement.clientHeight;    }
			    else if (document.body){return document.body.clientHeight;}      
			        return 0;
			}
			
function centerdivinwindow(side, divheight) {
	
	var browserheight = getBrowserHeight();
	var factor = 1;
	var offset = 0;

	if (side == 0) {
		var divid = '#front';
		offset = 0;
	} else {
		var divid = '#back';
		offset = 49;
	};

	if (browserheight<divheight) {
		factor = 1.4;
		$('#menu').css('margin-bottom','0px');
	} else if ((browserheight-divheight)/2 < 30) {
		$('#menu').css('margin-bottom','0px');
	} else {
		var newmargin = (browserheight-divheight)/2-30;
		$('#menu').css('margin-bottom', newmargin+'px');
	};
	var newtop = factor*(browserheight-divheight)/2 + offset;
	$(divid).css('top', newtop+'px');
	//var newbuytop = factor*(browserheight-divheight)/2 + offset + 400;
	//$('#buy').css('top', newbuytop+'px');
}

function onYouTubePlayerReady(playerId) { 
ytplayer = document.getElementById("video_overlay"); 
ytplayer.setVolume(100); 
}
