function addAllCaptions(){

		if(document.getElementById('newscopy')){
			el = document.getElementById('newscopy');	
			im = el.getElementsByTagName("img");
			for(i=0;i<im.length;i++){
				img = im[i];
				addCaption(img);
			}
		}
	
}

function addCaption( img){
	 var parent = img.parentNode;
      var frame = document.createElement('div');
      var div2 = document.createElement('div');
      theText = img.getAttribute('alt');     
      var txt = document.createTextNode(img.getAttribute('alt'));
      if(!txt){ return;}
      parent.insertBefore(frame, img);
      parent.removeChild(img);
      frame.appendChild(img);
      frame.appendChild(div2);
      div2.innerHTML = img.getAttribute('alt');
      //frame.appendChild(txt);
      // These are special cases.  We always copy these from the image to the
      // div.
      frame.style.width = img.getAttribute('width') + 'px';
      //frame.className = img.className;
      frame.className = "image_caption";
     
      // Copy specified attributes and style properties from the image to the
      // div.
     if(img.getAttribute("align")){
	     a = img.getAttribute("align");
	     if(!a){ a = "left";}
	     if(!frame.style.styleFloat){ frame.style.styleFloat = "left";}
	    
	     try{ 
		     if (document.all) {		    
			    frame.style.styleFloat = a;
			} else {
			    frame.style.cssFloat = a;
			}
		}
		catch(e){}		
		img.setAttribute("align","center");		
      }
      if(img.getAttribute("vspace")){
	   	frame.style.padding=img.getAttribute("vspace")+"px";  
	   	img.setAttribute("vspace",0);
	   	img.setAttribute("hspace",0);		   
      }
     if(img.style.border){
	  	frame.style.border=img.style.border;   
	  	img.style.border="0px solid #000";   
     }
     frame.style.fontSize="9px";
     frame.style.color="#666";
      
}


