var galerijaId="galerija"; 
var galerijaWidth=910; 
var galerijaHeight=400+150; 
var firstShow=true; 
var galerijaVisible=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 toggleGalerija(){
	if(firstShow){
		var style=document.getElementById(galerijaId).style;
		style.left=Math.round((getAvailableWidth()-galerijaWidth)/2 -8)+"px";
		style.top=Math.round((getAvailableHeight()-galerijaHeight)/2 -40)+"px";
		firstShow=false;
	}
	if(galerijaVisible){
		document.getElementById('galerija').style.display='none';
		galerijaVisible=false;
	}
	else{
		var style=document.getElementById('galerija').style;
		style.left=Math.round((getAvailableWidth()-galerijaWidth)/2 -8)+"px";
		style.top=Math.round((getAvailableHeight()-galerijaHeight)/2 -40)+"px";
		style.display='block';
		galerijaVisible=true;
	}
}
function initGalerija(){
	var element=document.getElementById(galerijaId);
	if(element==null) return;
	var style=element.style;
	if(style==null) return;
	style.visibility="visible";
	style.position="absolute";
	style.width=galerijaWidth+"px";
	style.height=galerijaHeight+"px";
}
function loadGalerija(){
	toggleGalerija();
}
