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) {
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()";
divNode.innerHTML='<img id="galimg" src="images/wait.gif" alt=""><br><p id="galcontent"></p><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);
}
