$(document).ready(function(){ 
$("img").each(function(){
if(!this.alt)
    return; 
 
var html = "";
html += "<table style='clear:both;'>";
html += "<tr><td onmousedown='expand(this)' style='text-decoration:underline;border:none;background:#066231;padding:4px;'>"+this.alt+"</td></tr>";
html += "<tr><td style='border:none;padding:0px;'><img style='margin:0px;' src='"+this.src+"' /></td></tr>";
html += "<table>"; 
 
$(this).replaceWith(html); 

}) 
});

function expand(e) {
    var td = e.parentNode.parentNode.lastChild.lastChild;

    td.parentNode.parentNode.parentNode.style.width = td.firstChild.offsetWidth;
  
    if(td.style.display!="none") 
        td.style.display = "none"; 
    else 
        td.style.display = "";  
 
 
}$(document).ready(function(){ 
$("img").each(function(){
if(!this.alt)
    return; 
 
var html = "";
html += "<table style='clear:both;'>";
html += "<tr><td onmousedown='expand(this)' style='border:none;padding:0px;color:white;background:#066231;padding:4px;'>"+this.alt+"</td></tr>";
html += "<tr><td style='padding:0px;'><img style='border:none;margin:0px;' src='"+this.src+"' /></td></tr>";
html += "<table>"; 
 
$(this).replaceWith(html); 

}) 
});

function expand(e) {
    var td = e.parentNode.parentNode.lastChild.lastChild;

    td.parentNode.parentNode.parentNode.style.width = td.firstChild.offsetWidth;
  
    if(td.style.display!="none") 
        td.style.display = "none"; 
    else 
        td.style.display = "";  
 
 
}
