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('today').style.height=minheight+'px';
	document.getElementById('container').style.height=minheight+'px';
	}
else {
	document.getElementById('today').style.display='none';
	}
}
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';
	}
}

var img=new Image();
var current=0;

function openpic2(pic,code) {
if (!document.getElementById('galimg'))
	initgal();
document.getElementById('galimg').src='images/wait.gif';
img.onload=mymove;
img.src='img_upl/'+pic;
document.getElementById('galcontent').innerHTML=code;
mymove2();
return false;
}
function openpic3(pic) {
if (!document.getElementById('galimg'))
	initgal();
document.getElementById('galimg').src='images/wait.gif';
img.onload=mymove;
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.display="none";
//document.getElementById('igal').style.display="none";
return false;
}

function mymove()  {
document.getElementById('galimg').src=img.src;
return mymove2();
}
function mymove2() {
var ghost=document.getElementById('gal');
var mytop=(document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);
var myleft=(document.documentElement.scrollLeft?document.documentElement.scrollLeft:document.body.scrollLeft);
var mywidth=(document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth);
var myheight=(document.documentElement.clientHeight?document.documentElement.clientHeight:document.body.clientHeight);
//var ighost=document.getElementById('igal');
var l=myleft+(mywidth-(img.width>0?img.width+30:ghost.offsetWidth))/2;
var t=mytop+(myheight-(img.height>0?img.height+50: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.display='block';
//ighost.style.display='block';
return true;
}

function initgal() {
var divNode = document.createElement('div');
divNode.id="gal"
divNode.onclick="hidepic()";
aaaa='<p style="text-align:center"><a onclick="return prev()" href="#">&laquo; '+txtprev+'</a> <a style="margin: 0px 50px;" onclick="return hidepic()" href="#">'+txtzamknij+'</a> <a onclick="return next()" href="#">'+txtnext+' &raquo;</a></p>';
divNode.innerHTML=aaaa+'<img id="galimg" src="images/wait.gif" alt=""><br><p id="galcontent"></p>'+aaaa;
document.body.appendChild(divNode);
}
