function dyngallery(loadingId)
{
	var picId='bigDynPic';
	if(!loadingId) {
		loadingId='loadingmessage';
	}
	var d=document.getElementById('thumbs');
	if(!d){return;}

	var piclinks=d.getElementsByTagName('a');
	for(var i=0;i<piclinks.length;i++)
	{
		piclinks[i].onclick=function()
		{
			document.getElementById(loadingId).style.display='block';
			var oldp=document.getElementById(picId);
			if(oldp)
			{
				oldp.parentNode.removeChild(oldp);
			}
			var nc=document.createElement('div');
			//document.getElementById(loadingId).appendChild(nc);
			//d.parentNode.insertBefore(nc,d);
			nc.style.display='none';
			nc.id=picId;
			var newpic=document.createElement('img');
			newpic.src=this.href;
			newpic.alt=this.getElementsByTagName('img')[0].alt;
			newpic.title='Zamknij obrazek';
			newpic.onload=function()
			{
				//document.getElementById(loadingId).style.display='none';
			}
			newpic.onclick=function()
			{
				this.parentNode.parentNode.removeChild(this.parentNode);
			}
			
			nc.appendChild(newpic);
			np=document.createElement('p');
			np.appendChild(document.createTextNode(this.getElementsByTagName('img')[0].alt))
			nc.appendChild(np);
			nc.style.display='block';
			document.getElementById(loadingId).appendChild(nc);
			return false;
		}
	}		
}

window.onload=function()
{
	if(document.getElementById && document.createTextNode)
	{
		document.body.onmouseover=function()
		{
			dyngallery('bigimage_container');	
		}																
		
	}
}
