function zoomImg()
{
  var divId='magnify';
  var d=document.getElementById('main');
  if(!d){return;}
  var piclinks=d.getElementsByTagName('img');
  for(var i=0;i<piclinks.length;i++)
  {
    piclinks[i].onclick=function()
    {
     var oldp=document.getElementById(divId);
      if(oldp)
      {
       oldp.parentNode.removeChild(oldp);
      }
      var nc=document.createElement('div');
      d.parentNode.appendChild(nc);
      nc.id=divId;
   
      var newpic=document.createElement('img');
      newpic.src=this.src;
      newpic.title='Click to close image.';
      nc.appendChild(newpic);
      newpic.onclick=function()
      {
       this.parentNode.parentNode.removeChild(this.parentNode);
      }     
    }
  }    
}

window.onload=function()
{
  if(document.getElementById && document.createTextNode)
  { zoomImg();}
}
