// JavaScript Document
function docHeight(){
	var h=0;
	if(typeof(window.innerHeight)=="number") {
		h=window.innerHeight;
	}else if((document.documentElement)&&(document.documentElement.clientHeight)){
		h=document.documentElement.clientHeight;
	}else if((document.body)&&(document.body.clientHeight)){
		h=document.body.clientHeight;
	}
	return h;
}

function docWidth(){
	var w=0;
	if(typeof(window.innerWidth)=="number") {
		w=window.innerWidth;
	}else if((document.documentElement)&&(document.documentElement.clientWidth)){
		w=document.documentElement.clientWidth;
	}else if((document.body)&&(document.body.clientWidth)){
		w=document.body.clientWidth;
	}
	return w;
}

//var ct=0;

function scrollBG(){
	if(document.getElementById("bg").style.display=="block"){
		var offSet=0;
		if(window.pageYOffset){
			offSet=window.pageYOffset;
		}else if(document.documentElement){
			offSet=document.documentElement.scrollTop;
		}else{
			offSet=document.body.scrollTop;
		}
		document.getElementById("bg").style.top=offSet+"px";
		//if(ct==0){
			//ct=Number(document.getElementById("vp").style.top.replace("px",""));
		//}
		//document.getElementById("vp").style.top=(ct+offSet)+"px";
	}
}

window.onscroll=scrollBG;

function showVideo(){
	var videoWidth=Number(document.getElementById("vp").style.width.replace("px",""));
	document.getElementById("bg").style.display = "block";
	document.getElementById("bg").style.height=docHeight()+"px";
	document.getElementById("vp").style.display = "block";
	document.getElementById("vp").style.left=(docWidth()-videoWidth)/2+"px";
}

function hideVideo(){
	document.getElementById("bg").style.display = "none";
	document.getElementById("vp").style.display = "none";
}

