var maxWidth = 150;
var maxHeight = 107;
function resize(id){
	var obj = document.getElementById(id); 

	imgScale = 1.0;
	htScale = 1.0;
	wdScale = 1.0;

	obj.orig_width = obj.width;
	obj.orig_height = obj.height;

	imgWidth = obj.width;
	imgHeight = obj.height;

	if ( imgHeight > maxHeight ) {
		htScale = maxHeight / imgHeight;
	}
	if ( imgWidth > maxWidth ) {
		wdScale = maxWidth / imgWidth;
	}
	imgScale = (htScale < wdScale) ? htScale : wdScale;
	imgWidth = imgScale * imgWidth;
	imgHeight = imgScale * imgHeight;

	obj.height = imgHeight;
	obj.width = imgWidth;
}

function openWin(obj){  
  var props = "width="+ (obj.orig_width+1) + ",height="+ (obj.orig_height+1);
  props += ",left=100,top=100,scrollbars=no";
  props += ",resizeable=yes,toolbars=no";

  var iw = window.open(obj.src,'imgWin',props);
  iw.close();
  iw = window.open(obj.src,'imgWin',props);
  iw.focus();
}
