var shownmenus=new Array();
var idHide=0;

function dropit(e,whichone,dropby,parent) {
themenu=document.getElementById(whichone);
themenuStyle=themenu.style;
if (themenuStyle.visibility=="visible")
	return false;
dropby.className='sel';
hidemenu2(0);

if (shownmenus.push) {
	shownmenus.push(whichone);
	}
else
	shownmenus[shownmenus.length]=whichone;
themenuStyle.visibility="visible";
return false;
}

function hidemenu() {
return hidemenu2(0);
}
function hidemenu2(parentid) {
i=shownmenus.length;
notfound=true;
while (i>0 && parentid!=shownmenus[i-1]) {
	if (shownmenus.pop)
		themenuid=shownmenus.pop();
	else {
		themenuid=shownmenus[shownmenus.length-1];
		shownmenus.length=shownmenus.length-1;
		}
//	iframestyle=document.getElementById('i'+themenuid).style;
//	iframestyle.display="none";
	document.getElementById(themenuid).style.visibility="hidden";
	document.getElementById('a'+themenuid).className='';
	i--;
	}
return false;
}

function donthide(e) {
	e.cancelBubble = true;
if (e.stopPropagation) {
	e.stopPropagation();
	}
else {
	}
return false;
}

//document.onclick=hidemenu

function clk(n) {
if(document.images){
	(new Image()).src="count.php?banner_id="+n;
	}
return true;
}

function getSWFHTML(DivID,plik,w,h) {
var swfNode = "";
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
	swfNode = '<embed type="application/x-shockwave-flash" src="'+ plik +'" width="'+ w +'" height="'+ h +'" quality="high" wmode="transparent">';
} else { // PC IE
	swfNode  = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ w +'" height="'+ h +'">';
	swfNode += '<param name="movie" value="'+ plik +'">';
	swfNode += '<PARAM NAME=quality VALUE=high>';
	swfNode += '<PARAM NAME=wmode VALUE=transparent>';
	swfNode += '</object>';
	}
document.getElementById(DivID).innerHTML=swfNode;
return false;
}

var idInt;
var scrollpos=0;
var mychild=1;

function InitScroll() {
scr=document.getElementById('scroller');
if (scr.childNodes.length>2) {
	idInt = window.setInterval("animuj()", 50);
	}
else if (scr.childNodes.length>0) {
	minheight=scr.offsetHeight;
	for (i=1;i<scr.childNodes.length;i++) {
		minheight2=scr.childNodes.item(i).offsetHeight+scr.childNodes.item(i-1).offsetHeight;
		if (minheight2<minheight)
			minheight=minheight2;
		}
	document.getElementById('container').style.height=minheight+'px';
	}
}
function animuj() {
scr=document.getElementById('scroller');
scrollpos--;
scr.style.top=scrollpos+'px';
i=0;
end=true;
if (mychild<scr.childNodes.length && (scrollpos+scr.childNodes.item(mychild).offsetTop<=0)) {
	window.clearInterval(idInt);
	window.setTimeout("InitScroll()", 1000);
	mychild++;
	}
if (scrollpos+scr.offsetHeight<=0) {
	mychild=0;
	scrollpos=document.getElementById('container').offsetHeight;
	scr.style.top=scrollpos+'px';
	}
}

function openpic2(pic,code) {
img=document.getElementById('galimg');
img.src='img_upl/'+pic;
document.getElementById('galcontent').innerHTML=code;
return false;
}

function openpic3(pic) {
img=document.getElementById('galimg');
img.src='img_upl/'+galeria[pic];
if (document.getElementById('galcode'+pic))
	document.getElementById('galcontent').innerHTML=document.getElementById('galcode'+pic).innerHTML;
else
	document.getElementById('galcontent').innerHTML='';
current=pic;
return false;
}

function next() {
if (current+1<galeria.length)
return openpic3(current+1);
else
return openpic3(0);
}
function prev() {
if (current>0)
return openpic3(current-1);
else
return openpic3(galeria.length-1);
}

function hidepic() {
document.getElementById('gal').style.visibility="hidden";
document.getElementById('igal').style.display="none";
return false;
}

function mymove()  {
whichone=document.getElementById('galimg');
if (whichone.src.indexOf('images/wait.gif')==-1)  {
	ghost=document.getElementById('gal');
	mytop=(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);
	myleft=(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);
	mywidth=(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth);
	myheight=(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);
	ighost=document.getElementById('igal');

	l=myleft+(mywidth-ghost.offsetWidth)/2;
	t=mytop+(myheight-ghost.offsetHeight)/2;
	ghost.style.left=(l>10?l+'px':'10px');
	ighost.style.left=ghost.style.left;
	ighost.style.width=ghost.offsetWidth+'px';

	ghost.style.top=(t>10?t+'px':'10px');
	ighost.style.top=ghost.style.top;
	ighost.style.height=ghost.offsetHeight+'px';
	ghost.style.visibility='visible';
	ighost.style.display='block';
	}
return true;
}

var prevData;

function customDateString() {
d = new Date();
if (d && (d.getHours()+d.getMinutes())!=prevData) {
	minuty=d.getMinutes();
	rok = d.getYear();
	if (rok<200) rok=rok+1900;
	if (minuty<10) minuty='0'+minuty;
	document.getElementById('data').innerHTML='<b>'+d.getHours()+':'+minuty+'</b> '+dow[d.getDay()]+', '+d.getDate()+' '+months[d.getMonth()]+' '+rok;
	prevData=d.getHours()+d.getMinutes();
	}
return false;
}

function InitAll() {
setInterval('customDateString()',1000);
}

function polec() {
document.getElementById('form_mailto').href='mailto:'+document.getElementById('form_email').value+'?subject='+document.getElementById('form_subject').value+'&body='+document.getElementById('form_body').value;
}