// togglesize(img, fullwidth, fullheight)
// CPKS 2003/10/02
//
// Behaviour: causes an image to alternate between half and full size.
// to use:
//
// <img src="blah.jpg" width="200" height="300"
//  alt="this is a picture &mdash; click to enlarge"
//  onclick="togglesize(this, 200, 300);" />

function togglesize(img, fullwidth, fullheight) {
  var alttext = new String;
  
  alttext = img.title;
  alttext = alttext.substring(0, alttext.indexOf("click to ") + 9);
  if (img.width == fullwidth) {
    img.width = fullwidth / 2;
    img.height = fullheight / 2;
    img.title=alttext + "enlarge"; 
  }
  else {
    img.width=fullwidth;
    img.height=fullheight;
    img.title = alttext + "shrink";
  }
}
