<!-- mikeys hacked pic zoomer -->

<!-- Begin
var zival, ztotal, zsteps, zmaxx, zmaxy, zcurrentx, zcurrenty, zdx, zdy;
function zoomImg(ztotal, zsteps, zmaxx, zmaxy)	{
  // convert the total from seconds to miliseconds
  // total = total * 1000;
  zcurrentx = document.images["maingallery"].width;
  zcurrenty = document.images["maingallery"].height;
  // work out how much we need to increase the image by each step
  // devide image sizes by number of steps to get the amount we need to change each step
  zstepx = zmaxx / zsteps;
  zstepy = zmaxy / zsteps;
  // devide the total time (in ms) by the number of steps to get the interval time
  zinttime = ztotal / zsteps;
  // set the interval to increase the size of the image by the required pixels 
  zfunctionRef = "resizeUp("+zstepx+", "+zstepy+", "+zmaxx+", "+zmaxy+")";
  zival = setInterval(zfunctionRef, zinttime);
}
function resizeUp(zdx, zdy, zmaxx, zmaxy) {
  zcurrentx = document.images["maingallery"].width;
  zcurrenty = document.images["maingallery"].height;
  if ((zcurrentx<zmaxx-zdx) && (zcurrenty<zmaxy-zdy)) {
    document.images["maingallery"].height = zcurrenty + zdy;
    document.images["maingallery"].width = zcurrentx + zdx;
  } else {
    clearInterval(zival);
    document.images["maingallery"].height = zmaxy;
    document.images["maingallery"].width = zmaxx;
  }
}

var sival, stotal, ssteps, smaxx, smaxy, scurrentx, scurrenty, sdx, sdy;
function shrinkImg(stotal, ssteps, smaxx, smaxy)	{
  // convert the total from seconds to miliseconds
  // total = total * 1000;
  scurrentx = document.images["maingallery"].width;
  scurrenty = document.images["maingallery"].height;
  // work out how much we need to increase the image by each step
  // devide image sizes by number of steps to get the amount we need to change each step
  sstepx = smaxx / ssteps;
  sstepy = smaxy / ssteps;
  // devide the total time (in ms) by the number of steps to get the interval time
  sinttime = stotal / ssteps;
  // set the interval to increase the size of the image by the required pixels 
  sfunctionRef = "resizeDown("+sstepx+", "+sstepy+", "+smaxx+", "+smaxy+")";
  sival = setInterval(sfunctionRef, sinttime);
}
function resizeDown(sdx, sdy, smaxx, smaxy) {
  scurrentx = document.images["maingallery"].width;
  scurrenty = document.images["maingallery"].height;
  if ((scurrentx>smaxx+sdx) && (scurrenty>smaxy+sdy)) {
    document.images["maingallery"].height = scurrenty - sdy;
    document.images["maingallery"].width = scurrentx - sdx;
  } else {
    clearInterval(sival);
    document.images["maingallery"].height = smaxy;
	document.images["maingallery"].width = smaxx;
  }
}

// mikeys picture sizer with cookies
function setPicSizeBig() {
  zoomImg (100, 15, 400, 266);
  setPicCookie ( "picstate", "big" );
}
function setPicSizeSmall() {
  shrinkImg (100, 10, 200, 133);
  setPicCookie ( "picstate", "small" );
}
function setPicCookie( name, value, expires, path, domain, secure ) {
  var today = new Date();
  today.setTime( today.getTime() );
  if ( expires ) {
    expires = expires * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );
  document.cookie = name+"="+escape( value ) +
    ( ( expires ) ? ";expires="+expires_date.toGMTString() : "" ) + //expires.toGMTString()
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}
//  End -->

