
    // retain object reference to image popup
    var imagePopup = null;
    var imagePopupName = "TownshipImageDisplay";

    function openSurveyImage (msID) {

        var url="TownshipImageDisplay.jsp?msID=" + msID;
        openTownshipImage(url);
    }

    function openStrImage (msID) {

        var url="TownshipImageDisplay.jsp?strID=" + msID;
        openTownshipImage(url);
    }


    function openTownshipImage (url) {

        var options = "SCROLLBARS=NO,STATUS=YES";

        // Get a reference to the window object, it may
        // already be open but not referenced here.
        imagePopup = window.open("", imagePopupName, options);

        // Reload the image if it isn't the requested one.

        if (imagePopup.location == null ||
            imagePopup.document.URL == null ||
            imagePopup.document.URL.indexOf(url) == -1) {
            imagePopup.location = url;
        }

        // Bring popup window to foreground.
        doFocusImage();

    }

    /**
     * Cause popup to happen through a setTimeout event,
     * so that it doesn't happen in the same thread as
     * the calling function.  (Fixes weird bug in IE.)
     */
    function doFocusImage() {
      setTimeout("focusImage()",1);
    }

    function focusImage() {
       if (imagePopup != null) {
          imagePopup.focus();
       }
    }


