var prefix='http://prominenti.atlas.sk/';
var imgpl = new Image;
imgpl.src = 'images/play.gif';
var imgpa = new Image;
imgpa.src = 'images/pause.gif';

function switchImg(el,st)
{
	document.getElementById(el).src=imagesArr[st+el].src;
}
function chkit(el)
{
	document.getElementById(el).checked=true;
}
function doGallery(idtext,idimage)
{
	var windowName = 'newWindow' + Math.floor(Math.random() * 100);
	window.open(BASE + 'gallery.php?idtext='+idtext+'&img='+idimage, windowName,'width=770,height=670');
}
function doGallery2(idtext,idimage)
{
	var windowName = 'newWindow' + Math.floor(Math.random() * 100);
	window.open(BASE + 'gallery2.php?idtext='+idtext+'&img='+idimage, windowName,'width=770,height=670');
}

function nextimg(idtext,idimage)
{
	document.location.href = BASE + 'gallery.php?idtext='+idtext+'&img='+idimage;
}
function nextimg2(idtext,idimage)
{
	document.location.href = BASE + 'gallery2.php?idtext='+idtext+'&img='+idimage;
}

function dopager()
{
	var pgrin=document.getElementById('pagerinn');
	var pgr=document.getElementById('pager');
	if(document.all) var wdth=(pgr.offsetWidth-pgrin.offsetWidth)/4;
	else var wdth=(pgr.offsetWidth-pgrin.offsetWidth)/2;
	pgrin.style.marginLeft=Math.floor(wdth)+'px';
}
function doRelated(idtext)
{
	window.name='original';
	window.open(BASE + 'links.php?idtext='+idtext,'links','width=500,height=550');
}
function replymsg(msgid)
{
	previd=document.getElementById('msgpar').value;
	if(previd=='')
	{
		window.scrollTo(0,0);
		document.getElementById('msgpar').value=msgid;
		document.getElementById('msg'+msgid).className='msgboxs';
		document.getElementById('msgsub').value='Re: '+document.getElementById('subj'+msgid).innerHTML;
	}
	else
	{
		if(msgid==previd)
		{
			document.getElementById('msgpar').value='';
			document.getElementById('msg'+msgid).className='msgbox';
			document.getElementById('msgsub').value='';
		}
		else
		{
			window.scrollTo(0,0);
			document.getElementById('msgpar').value=msgid;
			document.getElementById('msg'+previd).className='msgbox';
			document.getElementById('msg'+msgid).className='msgboxs';
			document.getElementById('msgsub').value='Re: '+document.getElementById('subj'+msgid).innerHTML;
		}
	}
}
function init()
{
	var l=document.getElementById('left');
	var inn=document.getElementById('mainbody');
	if(inn && l)
	{
		if(inn.offsetHeight<l.offsetHeight) inn.style.height=l.offsetHeight+'px';
	}
}
function dosform()
{
	var lf=document.getElementById("lff");
	var rf=document.getElementById("rff");
	if(lf) var lfh=lf.offsetHeight;
	else var lfh=0;
	if(rf) var rfh=rf.offsetHeight;
	else var rfh=0;
	if(rfh>lfh) 
	{
		lf.style.height=(rfh-2)+'px';
	}
	else if(lfh>rfh)
	{
		rf.style.height=(lfh-2)+'px';
	}
	
}
window.onload=init;


var current=0;
var pltim;
var paused=0;
function shl(sh)
{
	var i;
	for(i=0;i<=(playdivs-1);i++)
	{
		document.getElementById("nextann"+i).className="nodisp";
	}
	document.getElementById("nextann"+sh).className="disp";
}
function initpl()
{
	if (playdivs>0)
	{
		play();
	}
}
function play()
{
	shl(current);
	current++;
	if(current>(playdivs-1)) current=0;
	pltim=setTimeout("play();",8000);
}
function mkpause()
{
	if(paused==1)
	{
		document.getElementById('imgpause').src=imgpa.src;
		if(current==0) current=(playdivs-1);
		else current--;
		play();
		paused=0;
	}
	else
	{
		document.getElementById('imgpause').src=imgpl.src;
		stop();
		paused=1;
	}
}
function stop()
{
	clearTimeout(pltim);
}
function fwd()
{
	stop();
	paused=1;
	document.getElementById('imgpause').src=imgpl.src;
	if(current>=(playdivs-1)) current=0;
	else current++;
	shl(current);
}
function rew()
{
	stop();
	paused=1;
	document.getElementById('imgpause').src=imgpl.src;
	if(current==0) current=(playdivs-1);
	else current--;
	shl(current);
}
function showann(elid)
{
	document.getElementById(anndisp).className='nodisp';
	document.getElementById('txtanno'+elid).className='disp';
	anndisp='txtanno'+elid;
}
function onmenu(mid)
{
	document.getElementById('menuitem'+mid).className='menuitemsel';
}
function offmenu(mid)
{
	document.getElementById('menuitem'+mid).className='menuitem';
}

if(typeof Array.prototype.push == 'undefined') {
	Array.prototype.push = function() {
		for( var i = 0, b = this.length, a = arguments, l = a.length; i<l; i++ ) {
			this[b+i] = a[i];
		}
		return this.length;
	}
}

var infoBoardPopupDisplayed = false;
function showInfoBoardPopup(e) {
	!e ? e = window.event : null;
	//alert(e.clientX + " x " + e.clientY);
	if(infoBoardPopupDisplayed == false) {
		window.document.getElementById("infoBoardInfoPopUp").style.display = "block";
		window.document.getElementById("infoBoardInfoPopUp").style.top = (e.clientY - 144) + "px";
		window.document.getElementById("infoBoardInfoPopUp").style.left = e.clientX + "px";
		infoBoardPopupDisplayed = true;
	} else {
		window.document.getElementById("infoBoardInfoPopUp").style.display = "none";
		infoBoardPopupDisplayed = false;
	}
}