function popup(url,img_h,img_v,caption,title)
{
    img_h_space  = 20;
    img_v_space  = 75;
    window_h     = parseInt(img_h) + img_h_space;
    window_v     = parseInt(img_v) + img_v_space;
    options      = 'toolbar=0' +
                   ',status=0' +
                   ',menubar=0' +
                   ',scrollbars=0' +
                   ',resizable=0' +
                   ',width=' + window_h +
                   ',height=' + window_v;
    img_tag      = '<img src="'+url+'" width="'+img_h+'" height="'+img_v+'">';
    if (!title) 
        title = caption;
    content      =
      '<html>\n'+
      '<head><title>'+title+'<\/title><link rel="stylesheet" type="text/css" '+
      'href="./css/styles.css" title="Styles"><\/head>\n' +
      '<body bgcolor="#ffffff"><div class="popup">' + img_tag +
      '<p>' + caption + '<br>' + 
      '<a href="javascript:window.close();">Close Window<\/a>' +
      '<\/div><\/body>\n' +
      '<\/html>';
  
    if (typeof(viewImg) == 'object' && !viewImg.closed)
        viewImg.close();
    viewImg  = window.open('','viewImg',options);
    if (!viewImg.opener) 
        viewImg.opener = self;
    viewImg.document.open();
    viewImg.document.write(content);
    viewImg.document.close();
    viewImg.focus();
}

