function openDyn(elem, filler, w, h, videourl,videotext){

		this.elem = document.getElementById(elem);
		this.filler = document.getElementById(filler);
		this.elemWidth = w+40;
		this.elemHeight = h+40;	
		this.offPosX = this.elemWidth / 2;
		this.offPosY = this.elemHeight / 2;
		
		var scrOfY;
		var leftpos;
		var Ypos;
		
		scrOfY = 0;
 			if( typeof( window.pageYOffset ) == 'number' ) {
   				 scrOfY = window.pageYOffset;
  			} else if( document.body && ( document.body.scrollTop ) ) {
   				 scrOfY = document.body.scrollTop;
 			 } else if( document.documentElement && ( document.documentElement.scrollTop ) ) {
    			scrOfY = document.documentElement.scrollTop;
  			}
		
		var windowWidth, windowHeight;
		if (self.innerHeight) {
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth;
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
		
		Ypos = windowHeight / 2 - this.offPosY + scrOfY;
		leftpos = windowWidth / 2 - this.offPosX;
				
		this.elem.style.top=Ypos+'px';
 		this.elem.style.left=leftpos+'px';
 		
		this.elem.style.height = this.elemHeight + 'px';
		this.elem.style.width = this.elemWidth + 'px';
		
		this.elem.style.display='';
		this.filler.style.display='';
	
		var so = new SWFObject("http://verkkokirkko-production.abako.fi/flashplayer/vkplayer09.swf", "FLVPlayer", w, h, "8", "#FFFFFF");
		so.addVariable("flashVarContent", videourl);
		so.addParam("allowFullScreen", "true");
		so.addParam("allowScriptAccess", "sameDomain");
		so.addParam("wmode", "transparent");
		so.addVariable("flashVarSkin", "http://verkkokirkko-production.abako.fi/flashplayer/SkinUnderPlayStopSeekFullVol.swf");
		so.write(elem);
		
		try {
			var containerdiv;
			containerdiv = document.createElement('div');
			containerdiv2 = document.createElement('div');
			containerdiv.setAttribute('class','video_header');
			containerdiv.setAttribute('id','vHeader');		
			containerdiv.appendChild(containerdiv2);
			this.elem.insertBefore(containerdiv,this.elem.firstChild);
			
			document.getElementById("vHeader").onclick=function(){
				closeDyn(elem, filler);
			}	 
			
			} catch(e) { }
}

function closeDyn(elem, filler) {	
	this.elem = document.getElementById(elem);
	this.filler = document.getElementById(filler);	
	this.elem.style.display='none';
	this.filler.style.display='none';
	this.elem.innerHTML='';
}

function openElem(elem, w, h){

		this.elem = document.getElementById(elem);
		this.elem.className = 'container';
		this.elemWidth = w+40;
		this.elemHeight = h+40;	
		this.offPosX = this.elemWidth / 2;
		this.offPosY = this.elemHeight / 2;
		
		try {
			fillerdiv = document.createElement('div'); 
			fillerdiv.className = 'filler';
			fillerdiv.setAttribute('id', elem + 'pagefiller');	
			document.body.insertBefore(fillerdiv,document.body.firstChild);
			document.getElementById(elem + "pagefiller").onclick=function() {
				closeElem(elem, elem + 'pagefiller');
			}	
			
		} catch(e) { }	
		
		var scrOfY = 0;
		var leftpos = 0;
		var Ypos = 0;
		
 			if( typeof( window.pageYOffset ) == 'number' ) {
   				 scrOfY = window.pageYOffset;
  			} else if( document.body && document.body.scrollTop ) {
   				 scrOfY = document.body.scrollTop;
 			 } else if( document.documentElement && document.documentElement.scrollTop ) {
    			scrOfY = document.documentElement.scrollTop;
  			}

 		var windowWidth, windowHeight;
		if (self.innerHeight) {
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth;
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
		
		Ypos = windowHeight / 2 - this.offPosY + scrOfY;
		leftpos = windowWidth / 2 - this.offPosX;
				
		this.elem.style.top=Ypos+'px';
 		this.elem.style.left=leftpos+'px';
 		
		this.elem.style.height = this.elemHeight + 'px';
		this.elem.style.width = this.elemWidth + 'px';
		
		this.elem.style.display='';
		
			try {
			var containerdiv;
			containerdiv = document.createElement('div');
			containerdiv2 = document.createElement('div');
			containerdiv.className = 'video_header';
			containerdiv.setAttribute('id',elem + 'containerheader');		
			containerdiv.appendChild(containerdiv2);
			this.elem.insertBefore(containerdiv,this.elem.firstChild);
			
			document.getElementById(elem + "containerheader").onclick=function(){
				closeElem(elem, elem + 'pagefiller');
			}	 
			
			} catch(e) { }

}


function closeElem(elem, filler) {	
	this.elem = document.getElementById(elem);
	this.filler = document.getElementById(filler);	
	this.closer = document.getElementById(elem + 'containerheader');	
	this.elem.style.display='none';
	document.body.removeChild(this.filler);
	try {
			this.elem.removeChild(this.closer); 
			
			} catch(e) { }
}
	
function openradio(urli,navi) {
	 radiowindow = window.open(urli,'radiowindow','menubar=1,resizable=1,width=170,height=150');
	 radiowindow.focus();
}

function SetValue(name,value){
	var exp = new Date();
	exp.setYear(exp.getFullYear()+1);
	document.cookie = name + "=" + value + ";path=/;expires=" + exp.toGMTString();
}

function GetValue(name){
	var dc = document.cookie;
	var prefix = name + "=";
	var begin = dc.indexOf("; " + prefix);
	if (begin == -1) {
		begin = dc.indexOf(prefix);
		if (begin != 0) return null;
	} else {
		begin += 2;
	}
	var end = document.cookie.indexOf(";", begin);
	if (end == -1) {end = dc.length;}
	return unescape(dc.substring(begin + prefix.length, end));
}