function loadLargerImage ( evt ) {

  var imagelink = null ;

  if ( evt ) {
    imagelink = evt.target ;
  } else {
    evt = window.event ;
    imagelink = evt.srcElement ;
  }

  while ( imagelink.tagName != 'A' ) {
    imagelink = imagelink.parentNode ;
  }

  if ( imagelink.className != 'largerimage' ) return true ;

  var windowFeatures = "resizable,top=0,left=0" ;
  var image ;
  var altText = "" ;
  var strWidth = "100%" ;

  var styleForm = "" ;

  if ( image = imagelink.firstChild ) {
    altText = imagelink.firstChild.alt.replace(/ ?Larger image available.?/ , "" ) ;

    var width = image.width * 2 ;
    var height = image.height * 2 + 45;

    var imageWidth = image.width * 2 ;
    var imageHeight = image.height * 2 ;

    strWidth = width + 'px' ;
    windowFeatures += ",height=" + height  + ",width=" + width ;
    styleForm = 'text-align:center;' ;
  } else {
    return true ;
  }

  styleForm += 'margin:0;padding: 0.5em 0 0;width:' + strWidth + ';' ;

  var title = altText || "Large Image" ;

  wnd = window.open("","imageViewer",windowFeatures) ;
  wnd.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"\n        "http://www.w3.org/TR/html4/strict.dtd">\n<html lang="en">\n <head>\n') ;
  wnd.document.write('  <style media="print" type="text/css">\n  <!--\n   form { display : none ; }\n  -->\n  </style>\n') ;
  wnd.document.write('  <title>' + title + '</title>\n </head>\n <body style="margin:0;padding:0;">\n') ;
  wnd.document.write('  <img width="' + imageWidth + '" height="' + imageHeight + '" src="' + imagelink + '" alt="' + altText + '" />\n') ;
  wnd.document.write('  <form style="' + styleForm + '" action="javascript:window.close();">\n   <input style="width:6em" type="submit" value="Close" />\n   <input style="width:6em" onclick="javascript:window.print();" type="button" value="Print" />\n  </form>\n') ;
  wnd.document.write(' </body>\n</html>') ;
  wnd.document.close() ;

  if ( window.blur ) {
    wnd.blur();
  }
  if ( window.focus ) {
    wnd.focus();
  }

  return false ;

}

function setupLargerImages ( evt ) {

  initialise ( ) ;

  if ( document.getElementById ) {

    var images = document.getElementById( "content" ).getElementsByTagName( "img" ) ;

    for ( var i = 0 ; i < images.length ; i++ ) {
      if ( images[i].parentNode.className == "largerimage" ) {
        images[i].parentNode.onclick = loadLargerImage ;
      }
    }

  }

}

window.onload = setupLargerImages ;

