function getPos(){
	var pos;
	if (window.innerHeight)
	{
		  pos = window.pageYOffset;
	}
	else if (document.documentElement && document.documentElement.scrollTop)
	{
		pos = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		  pos = document.body.scrollTop;
	}	
	return pos;
}

//img-request for popup
function imgRequest(fileid){
	var myAjax = new Ajax();
	myAjax.url="index.php";
	myAjax.params="article_id=7&fileid="+fileid+"&browserwidth="+window.getWidth()+"&browserheight="+window.getHeight()+"";
	myAjax.method="GET";
	myAjax.onSuccess = popInsert;
	myAjax.onError=function(msg){alert(msg)}
	myAjax.doRequest();
}

//video request for popup
function flvRequest(vid_path, vidwidth, vidheight, loop, replacepic_path){
	var opspan = document.createElement("span");
	opspan.id = "opspan";
	opspan.style.width = ""+window.getWidth()+"px";
	opspan.style.height = ""+window.getScrollHeight()+"px";
	opspan.style.backgroundColor = "#000";
	opspan.style.opacity = "0.82";
	opspan.style.filter = "alpha(opacity=82)";
	opspan.style.position = "absolute";
	opspan.style.top = "0";
	opspan.style.left = "0";
	opspan.style.zIndex = "5";
	opspan.style.display = "block";
	
	var infopop = document.createElement("div");
	infopop.id = "infopop";
	infopop.style.backgroundColor="#fff";
	infopop.style.border = "2px solid #fff";
	infopop.style.position = "absolute";
	infopop.style.zIndex = "15";
	infopop.style.top = ""+(50+window.getScrollTop())+"px";
	infopop.style.left = "auto";
	infopop.style.right = "auto";
	
	infopop.innerHTML = '<div id="flv" style="z-index:25;"><img src="'+replacepic_path+'" alt="flashvideo replacement" /></div>';
	document.getElementById("wrap").appendChild(opspan);
	document.getElementById("wrap").appendChild(infopop);
	
	//use swfobject
	var so = new SWFObject("./files/videoplayer.swf", "flvideo", ""+vidwidth+"", ""+vidheight+"", "7", "#b4ffaa");
	so.useExpressInstall("./files/expressinstall.swf");
	so.addParam("wmode", "transparent");
	so.addVariable("vid", ""+vid_path+"");
	so.addVariable("vidwidth", ""+vidwidth+"");
	so.addVariable("vidheight", ""+vidheight+"");
	so.addVariable("autop", "true");
	so.addVariable("showctrl", "false");
	so.addVariable("loopvid", ""+loop+"");
	so.write("flv");
	
	$('infopop').addEvent('click', function(){
		removePop();
	});
	$('infopop').addEvent('mouseover',function(){
		this.style.cursor = "pointer";							 
	});
}

//request for quicktime popup
function qtRequest(fileid, width, height, replacefile_id,loop){
	var myAjax = new Ajax();
	myAjax.url="index.php";
	myAjax.params="article_id=7&qtid="+fileid+"&browserwidth="+window.getWidth()+"&browserheight="+window.getHeight()+"&vidwidth="+width+"&vidheight="+height+"&replaceid="+replacefile_id+"&loop="+loop+"";
	myAjax.method="GET";
	myAjax.onSuccess = qtInsert;
	myAjax.onError=function(msg){alert(msg)}
	myAjax.doRequest();
}

//popup-functions
function popInsert(txt, xml){
	var opspan = document.createElement("span");
	opspan.id = "opspan";
	opspan.style.width = ""+window.getWidth()+"px";
	opspan.style.height = ""+window.getScrollHeight()+"px";
	opspan.style.backgroundColor = "#000";
	opspan.style.opacity = "0.82";
	opspan.style.filter = "alpha(opacity=82)";
	opspan.style.position = "absolute";
	opspan.style.top = "0";
	opspan.style.left = "0";
	opspan.style.zIndex = "5";
	opspan.style.display = "block";
	
	var infopop = document.createElement("div");
	infopop.id = "infopop";
	infopop.style.backgroundColor="#fff";
	infopop.style.border = "2px solid #fff";
	infopop.style.position = "absolute";
	infopop.style.zIndex = "15";
	infopop.style.top = ""+(25+window.getScrollTop())+"px";
	infopop.style.left = "auto";
	infopop.style.right = "auto";
	
	infopop.innerHTML = ""+txt+"";
	document.getElementById("wrap").appendChild(opspan);
	document.getElementById("wrap").appendChild(infopop);
	$('infopop').addEvent('click', function(){
		removePop();
	});
	$('infopop').addEvent('mouseover',function(){
			this.style.cursor = "pointer";							 
	});
}

function qtInsert(txt, xml){
	var opspan = document.createElement("span");
	opspan.id = "opspan";
	opspan.style.width = ""+window.getWidth()+"px";
	opspan.style.height = ""+window.getScrollHeight()+"px";
	opspan.style.backgroundColor = "#000";
	opspan.style.opacity = "0.82";
	opspan.style.filter = "alpha(opacity=82)";
	opspan.style.position = "absolute";
	opspan.style.top = "0";
	opspan.style.left = "0";
	opspan.style.zIndex = "5";
	opspan.style.display = "block";
	
	var infopop = document.createElement("div");
	infopop.id = "infopop";
	infopop.style.backgroundColor="#fff";
	infopop.style.border = "2px solid #fff";
	infopop.style.position = "absolute";
	infopop.style.zIndex = "15";
	
	infopop.style.top = ""+(25+window.getScrollTop())+"px";
	infopop.style.left = "auto";
	infopop.style.right = "auto";
	
	infopop.innerHTML = ""+txt+"<p>click here to close</p>";
	document.getElementById("wrap").appendChild(opspan);
	document.getElementById("wrap").appendChild(infopop);
	$('infopop').addEvent('click', function(){
		removePop();
	});
	$('infopop').addEvent('mouseover',function(){
			this.style.cursor = "pointer";							 
	});
}


function removePop(){
	var plane = $('opspan');
	var pu = $('infopop');
	pu.parentNode.removeChild(pu);
	plane.parentNode.removeChild(plane);
}

function switchinfo(blockid){
	var infoblock = $('infoblock'+blockid);
	if(infoblock.hasClass('on')){
		infoblock.style.display = "none";
		infoblock.removeClass('on');
	}
	else{
		infoblock.style.display = "block";
		infoblock.addClass('on');
	}	
}

//popup events auf bilder
window.addEvent('domready', function(){
	if($defined($('splash_logo'))){
		logo_height = 215;
		$('splash_logo').setStyle('margin-top', (window.getHeight()/2)-(logo_height/2)+'px');
	}
	$$('img.imgpop').each(function(el){
		el.style.display = "block";
		el.addEvent('click',function(el){
			var fileid = this.className.substr(7);
			imgRequest(fileid);							 
		});
		el.addEvent('mouseover',function(el){
			this.style.cursor = "pointer";							 						 
		});			   
	});
	//austellungs-infos
	/*
	$$('div.exhib_txt').each(function(el){
		el.style.display = "none";					
	});
	$$('p.exhib_info_switch').each(function(el){
		el.addEvent('click',function(el){
			var blockid = this.id.substr(10);
			switchinfo(blockid);
		});
		el.addEvent('mouseover',function(el){
			this.style.cursor = "pointer";							 						 
		});
											
	});
	*/
});
