// Dimin Image JavaScript Tools
// Copyright (c) 2003 Dmitry Fedorov
// Designed for IE 4 and up, Netscape 7 and up
// v 1.0 

var oW, oH;
var vImageWidth, vImageHeight;
var newWidth, newHeight;
var maxWidth = 640;

function adjustSize(myImage)
{
  if ( (oW > 1) && (oH > 1) )
  {
    vImageWidth  = oW;  
    vImageHeight = oH;
  }
  else
  {
    oW = myImage.width;
    oH = myImage.height;  	
  }  
  
  newWidth  = vImageWidth;
  newHeight = vImageHeight;
  if (vImageWidth >= maxWidth)
  {
    newWidth = maxWidth;
    newHeight = vImageHeight * (maxWidth/vImageWidth);	 
  }
  else
  {
    newWidth  = vImageWidth;
    newHeight = vImageHeight;
  }

  myImage.width = newWidth;  
  myImage.height = newHeight;
}

function setZoom(zoom, myImage) 
{
  if (zoom == -1)
  {
    vImageWidth    = vImageWidth / 2;
    vImageHeight   = vImageHeight / 2;
    myImage.width  = vImageWidth;
    myImage.height = vImageHeight;
  }
  if (zoom == 1)
  {
    vImageWidth    = vImageWidth * 2;
    vImageHeight   = vImageHeight * 2;
    myImage.width  = vImageWidth;
    myImage.height = vImageHeight;
  }
}

function getImageSize(myImage) 
{
  newImg = new Image ();
  newImg.src = myImage.src;
  oW = newImg.width;
  oH = newImg.height;
  delete newImg;
}

function init(myImage) 
{
  getImageSize(myImage);
  adjustSize(myImage);
}



