<!--// hide from non-javascript-aware browsers

function setcol(o,col) {
	o.style.backgroundColor = col;
}

function SetImg(image,file) {
        image.src=file;
}

function getwindowsize() {
  wsize=windowsize();  
  return( '&wx=' + wsize[0] + '&wy=' + wsize[1] );
}

function windowsize() {
// Uses code from http://www.howtocreate.co.uk/tutorials/index.php?tut=0&part=16
  var size=new Array(2);
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    size[0] = window.innerWidth;
    size[1] = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      size[0] = document.documentElement.clientWidth;
      size[1] = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        size[0] = document.body.clientWidth;
        size[1] = document.body.clientHeight;
      }
    }
  }
  return( size );
}

function fit_image(imagename,tablename,tdname,im_width,im_height,bordersizex,bordersizey,top,captionsize) {

  var xscale, yscale, scale;

  wsize=windowsize();
  xmargin=20; // X page margin
  ymargin=20; // Y page margin

  xscale=(wsize[0]-bordersizex-2*xmargin)/im_width;
  yscale=(wsize[1]-top-captionsize-bordersizey-2*ymargin)/im_height;
  if (xscale<yscale) scale=xscale; else scale=yscale;

  image=document.getElementById(imagename);
  td=document.getElementById(tdname);
  table=document.getElementById(tablename);

  td.width=Math.round(im_width*scale);
  table.width=Math.round(im_width*scale)+bordersizex;
  image.width=Math.round(im_width*scale);
  image.height=Math.round(im_height*scale);

}

//-->

