// JavaScript Document
//-----------------------------------------------------------------
var max_zoom=4.0;        // Max allowable width                  |
var min_zoom=0.1;         // Min allowable width                  |
var step=0.2;               // % by which image should zoomm   |
var zoom=1.0;
var direc=1;              // direction of last op = 1=up, 0=down
//-----------------------------------------------------------------

function zoom_out(z)
{
   if (direc==1){
      direc=0;
      zoom=1.0-step;
   } 
   else {
      zoom-=step;
   }
   if(zoom>min_zoom) {
    zoomImage(z,zoom);
   }
} 

function zoom_in(z)
{
   if (direc==0){
      direc=1;
      zoom=1.0+step;
   }
   else {
      zoom+=step;
   }
   if(zoom<max_zoom) {  
    zoomImage(z,zoom);
    dir=1;
   }
} 

function getMap(elImage) 
{
// Be sure a map is specified for the image.
   if (null != elImage.getAttribute('usemap')) 
   {
      // Remove the leading # from the bookmark.
      var strMap = elImage.getAttribute('usemap').substring(1);
      // Return the element with the specified name.
      return strMap;
   }
      return null;
}

function zoomImage(elImage, amount) 
{
   // Expand the image the specified amount.
   var elMap = getMap(elImage);
   elImage.width *= amount;
   elImage.height *= amount;
   // If an image map is available, scale it too.
   if (null != elMap) 
   {
      elMap=document.getElementsByName(elMap)[0];
      for (var intLoop = 0; intLoop < elMap.areas.length; intLoop++) 
      {
         var elArea = elMap.areas[intLoop];
         // Break the coordinates string into an array.
         var coords = elArea.coords.split(",");
         var scaledCoords = "";
         // Rebuild the new scaled string.
         for (coord in coords) 
         {
             scaledCoords += (coords[coord] * amount) + ",";
         }

         // Put the scaled coordinates back into the map.
            elArea.coords = scaledCoords;
      }
   }
}
