var showWidth=10;
var showHeight=10;
var fb=10;
var startWidth=10;
var startHeight=10;
var startFb=10;

function calculate_dims(zoomer){  
  showWidth  = startWidth;
  showHeight = startHeight;
          fb = startFb;
  if (zoomer){
      var ww = 220;
    colWidth = ww -18;
    picWidth   = showWidth + (2*fb);
    if (picWidth > colWidth){
       showWidth = Math.floor(startWidth*colWidth/picWidth);
      showHeight = Math.floor(startHeight*colWidth/picWidth);
              fb = Math.floor(startFb*colWidth/picWidth);
    }
  }
}
function portrait(photopath,askWidth,askHeight,askFb, action){
  // photopath = photo file path 
  // showWidth, showHeight photo *display* width and height 
  // fb = frame breadth
  // omitting >> align="center" valign="middle"  for now
  // This Javascrpt program (c) 2008-9 IPH 
    startWidth = askWidth;
   startHeight = askHeight;
       startFb = askFb; // frame breadth
  little = true;
  if (action=="hidezoom"){
    little = false;
  }
  calculate_dims(little);
  td1='<td><img src="';
  tdc2='" width="'+fb+'" height="'+fb+'" /></td>';         // frame corner 
  tdh2='" width="'+showWidth+'"  height="'+fb+'" /></td>'; // frame horiz 
  tdv2='" width="'+fb+'" height="'+showHeight+'" /></td>'; // frame vert
		document.write('<div ');
		if(little){
		document.write('id="portrait1" ');
		}else{
		document.write('id="portrait2" ');
		}
		document.write('><table border="0" cellpadding="0" cellspacing="0" align="center"><tr>');
		document.write( td1+'/profiles/img/gold_tl.jpg" name="i1'+tdc2+td1+'/profiles/img/gold_ts.jpg" name="i2'+tdh2+td1+'/profiles/img/gold_tr.jpg" name="i3'+tdc2+'</tr><tr>');
		document.write( td1+'/profiles/img/gold_ls.jpg" name="i4'+tdv2);
		document.write('<td><img src="'+photopath+'" name="i5" width="'+showWidth+'" height="'+showHeight+'" ');
		if (action==''){
		document.write('title="No larger photo provided"	style=" cursor: default;" ');
		}else{
		document.write('onclick="'+action+'();" ');
		  if (little){
    		document.write('title="Click to see enlarged"	');
		  }else{
    		document.write('title="Click to restore"	');
		  }
		}
		document.write('/></td>'+td1+'/profiles/img/gold_rs.jpg" name="i6'+tdv2+'</tr><tr>');
		document.write( td1+'/profiles/img/gold_bl.jpg" name="i7'+tdc2+td1+'/profiles/img/gold_bs.jpg" name="i8'+tdh2+td1+'/profiles/img/gold_br.jpg" name="i9'+tdc2+'</tr></table></div>');
}

