var bV=parseInt(navigator.appVersion);
NS4=(document.layers) ? true : false;
IE4=((document.all)&&(bV>=4))?true:false;
ver4 = (NS4 || IE4) ? true : false;


        zoomed = false;
        scale = 1;

if (ver4) {
        if (NS4) { document.captureEvents(Event.CLICK) }
        firstZoom = true;
        document.onclick = findIt;

} //endif (ver4)


function findIt(e) {
        gotit = false;
        if (IE4) {
            whichIm = new Image();
            if (event.srcElement.name && event.srcElement.name.indexOf("imZ") != -1) {
                  isAnchor = (event.srcElement.parentElement.tagName == "A") ? 1 : 0;
                  if (isAnchor && event.srcElement.parentElement.href) {
                    whichIm.src = event.srcElement.parentElement.href;
                    gotit = true;
                  }
                  window.event.returnValue = false;
                }
                else {
                  window.event.returnValue = true;
                }

        }
        else {
            l = e.pageX; t = e.pageY;
                for (i=0; i<document.images.length; i++) {
                    if (document.images[i].name.indexOf("imZ") != -1) {
                        imX1 = document.images[i].x;
                        imX2 = imX1 + document.images[i].width;
                        imY1 = document.images[i].y;
                        imY2 = imY1 + document.images[i].height;
                        if ((l >= imX1 && l <= imX2) && (t >= imY1 && t<= imY2)) {
                          if (e.target!="") {
                            whichIm = new Image();
                            whichIm.src = e.target;
                            gotit = true;
                            window.event = false;
                          } else {
                            whichIm = document.images[i];
                            gotit = true;
                          }
                        }
                    }
                }
        }

        if (gotit) { zoomOut(whichIm); return false }
                else { if (zoomed) {zoomIn()}; return true }

} //end findIt


function zoomIn() {
        document.elZoom.visibility='hidden';
        zoomed=false;
} //end ZoomIn


function zoomOut(whichIm){
        if (zoomed) {zoomIn(); return}
        if (NS4) {
          bigImStr  = "<A HREF='javascript:zoomIn()'>";
          bigImStr += "<IMG NAME='imBig' SRC=\"" + whichIm.src + "\" border=0>";
        } else {
          bigImStr  = "<A style=\"color:#FFFFFF\" HREF='javascript:zoomIn()'>";
          bigImStr += "<IMG NAME='imBig' SRC=\"" + whichIm.src + "\" style='border-color: #999999;' border=1>";
        }
        bigImStr += "</A>";

        if (NS4) {
          with (document.elZoom.document) {
            open();
            write(bigImStr);
            close();
          }
          newWidth  = parseInt(document.elZoom.document.imBig.width);
          newHeight = parseInt(document.elZoom.document.imBig.height);
        }
        else {
          elZoom.innerHTML = bigImStr;
          do {
            if (imBig.complete == true) {
              break;
            }
          }
          while (imBig.complete == true)
          newWidth = parseInt(imBig.width);
          newHeight = parseInt(imBig.height);
        }

        winWidth = (NS4) ? window.innerWidth  : document.body.clientWidth;
        winHeight = (NS4) ? window.innerHeight : document.body.clientHeight;

        if (IE4) {
                document.elZoom.left = parseInt(winWidth/2 - newWidth/2);
                document.elZoom.top = parseInt(winHeight/2 - newHeight/2) + document.body.scrollTop;
                winPosEl = elZoom.offsetTop - document.body.scrollTop;
        }
        else {
                document.elZoom.left = parseInt(winWidth/2 - 10 - newWidth/2);
                document.elZoom.top = parseInt(winHeight/2 - 10 - newHeight/2) + pageYOffset;
                winWidth = innerWidth;
                winHeight = innerHeight;
                winPosEl = document.elZoom.top - pageYOffset;
        }

        document.elZoom.visibility = "visible";
        zoomed = true;
} //end zoomOut
