function clk(n) {
if(document.images){
	(new Image()).src="count.php?banner_id="+n;
	}
return true;
}

function getSWFHTML(plik,w,h,DivId) {
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>';
	}
if (DivId)
	document.getElementById(DivId).innerHTML=swfNode;
else
	document.write(swfNode);
return false;
}

var img=new Image();
var liczba=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,code) {
if (!document.getElementById('galimg'))
	initgal();
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=document.getElementById('img'+pic).childNodes.item(0).title;
img.onload=mymove;
img.src='img_upl/'+galeria[pic];
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);
//document.getElementById('galcontent').style.width=(img.width>0?img.width:ghost.offsetWidth-30)+'px';
//var l=myleft+(mywidth-(img.width>0?Math.max(img.width,document.getElementById('galcontent').offsetWidth)+30:ghost.offsetWidth))/2;
var l=myleft+(mywidth-ghost.offsetWidth)/2;
//var t=mytop+(myheight-(img.height>0?img.height+50:ghost.offsetHeight))/2;
var t=mytop+(myheight-ghost.offsetHeight)/2;
ghost.style.left=(l>10?l+'px':'10px');
ghost.style.top=(t>10?t+'px':'10px');
ghost.style.display='block';
//alert(ghost.offsetWidth);
return true;
}

function initgal() {
var divNode = document.createElement('div');
divNode.id="gal"
divNode.onclick="hidepic()";
divNode.innerHTML='<img id="galimg" src="images/wait.gif" alt=""><div id="galcontent"></div><p align=right><a onclick="return prev()" href="#">&laquo; '+txtprev+'</a> <a onclick="return hidepic()" href="#">'+txtzamknij+'</a> <a onclick="return next()" href="#">'+txtnext+' &raquo;</a></p>';
document.body.appendChild(divNode);
}

function adres(elem,p1,p2,p3) {
elem.href='mailto:'+p3+'@'+p2+p1;
return true;
}


