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;
}

function openpic2(pic,code) {
img=new Image();
img.onload=mymove;
img.src='img_upl/'+galeria[pic];
document.getElementById('galcontent').innerHTML=code;
mymove2();
return false;
}

function openpic3(pic) {
img=new Image();
img.onload=mymove;
img.src='img_upl/'+galeria[pic];
document.getElementById('galimg').src='images/wait.gif';
if (document.getElementById('galcode'+pic))
	document.getElementById('galcontent').innerHTML=document.getElementById('galcode'+pic).innerHTML;
else
	document.getElementById('galcontent').innerHTML='';
current=pic;
mymove2();
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-ghost.offsetWidth)/2;
var 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.display='block';
ighost.style.display='block';
return true;
}
