function dyngallery() 

{ 

    var picId='bigDynPic'; 

    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() 

        { 

             var oldp=document.getElementById(picId); 

             if(oldp) 

             { 

              oldp.parentNode.removeChild(oldp); 

             } 

             var nc=document.createElement('div'); 

             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='Click to return to images'; 

             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'; 

             return false; 

        } 

    }        

  

} 
