var receptiId="recepti"; 
var receptiWidth=910; 
var receptiHeight=400+150; 
var firstShow=true; 
var receptiVisible=false;

function getAvailableWidth(){
	var calcWidth=0;
	if(window.innerWidth)calcWidth=window.innerWidth;
	else calcWidth=(document.compatMode=='CSS1Compat'?document.documentElement.clientWidth:document.body.clientWidth);
	return calcWidth;
}
function getAvailableHeight(){
	var calcHeight=0;
	if(window.innerHeight) calcHeight=window.innerHeight;
	else calcHeight=(document.compatMode=='CSS1Compat'?document.documentElement.clientHeight:document.body.clientHeight);
	return calcHeight;
}
function toggleRecepti(){
	if(firstShow){
		var style=document.getElementById(receptiId).style;
		style.left=Math.round((getAvailableWidth()-receptiWidth)/2 -8)+"px";
		style.top=Math.round((getAvailableHeight()-receptiHeight)/2 -40)+"px";
		firstShow=false;
	}
	if(receptiVisible){
		document.getElementById('recepti').style.display='none';
		receptiVisible=false;
	}
	else{
		var style=document.getElementById('recepti').style;
		style.left=Math.round((getAvailableWidth()-receptiWidth)/2 -8)+"px";
		style.top=Math.round((getAvailableHeight()-receptiHeight)/2 -40)+"px";
		style.display='block';
		receptiVisible=true;
	}
}
function initRecepti(){
	var element=document.getElementById(receptiId);
	if(element==null) return;
	var style=element.style;
	if(style==null) return;
	style.visibility="visible";
	style.position="absolute";
	style.width=receptiWidth+"px";
	style.height=receptiHeight+"px";
}
function loadRecepti(){
	toggleRecepti();
}
