﻿/* ************************************************** *
 *  
 *  zoomwindow : wrappers 
 * 
 * ************************************************** */
var Zoom={   //begin the object Zoom

// ================================================
// public properties of zoom object
// ================================================
divBoxId : "",
LinkButtonId : "",        //the id if the 'can zoom' button
CandidateList : new Array(""),  //array of images which have capaabilities

/********************************************************
zoomify methods
********************************************************/
Constructor : function(zoomDiv, zoomButton)
{  // populate private global properties  
   this.divBoxId       = zoomDiv;
   this.LinkButtonId  = zoomButton; 
},
isVisible : function() 
{  // test to see if zoom div is define in html. return true or false 
    return false;
    var zoomBox = document.getElementById(this.divBoxId);
    if (zoomBox == null) return false;
    if (zoomBox.style.visibility=="visible") 
        return true;
    else 
        return false;        
},
Show : function(aDoIt)
{   // display the div element
    return;
    if (aDoIt == 'true')
    {
        var zoomBox = document.getElementById(this.divBoxId);
        if (zoomBox != null) {
            zoomBox.style.visibility="visible";
        }            
    }
},  
Hide : function()
{   // hide the zoom display the div element
    return;
    var zoomBox = document.getElementById(this.divBoxId);
    if (zoomBox != null) zoomBox.style.visibility="hidden"; 
},  
ShowButton : function(aImage)
{  // make visible the 'click to zoom' link if a match in array
    var zoomLink = document.getElementById(this.LinkButtonId);
    var zImage = aImage.toLowerCase();
    if (zoomLink != null)
    {  
        for (i=0; i <= this.CandidateList.length; i++)
        {
            if (zImage == this.CandidateList[i])
            {
                zoomLink.style.visibility="visible"; 
                return;
            }
        }
        zoomLink.style.visibility = "hidden";  
    }
},
open : function()
{
    var sImage = Common.getCurrentImage();
    var sResizeDir = 'images/'+Common.getCurrentGallery()+'/' 
    if (!Common.emptyFeatureView()) {
        sImage =  Common.getFeatureView();
        sResizeDir = 'images/'+Common.getCurrentGallery()+'/views/'+Common.getCurrentImageName()+'/' ;
    }
    var sZoomDir = 'images/'+Common.getCurrentGallery()+'/Zoom/'    
    var sUrl = new String(document.URL);
    sUrl = sUrl.substring(0,sUrl.lastIndexOf("/")+1);
    var zoomwin= window.open ('', 'ToggleZoom', '');
    zoomwin.document.writeln('<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">');
    zoomwin.document.writeln('<html xmlns="http://www.w3.org/1999/xhtml">');
    zoomwin.document.writeln('<head><script language=\"JavaScript\" type=\"text/javascript\" src=\"'+sUrl+'toggle.js\"></script>');
    zoomwin.document.writeln('<script language=\"JavaScript\" type=\"text/javascript\">');
    zoomwin.document.writeln('ZoomDir = \'' + sZoomDir + '\'; ResizeDir = \'' + sResizeDir + '\'; sImage = \'' + sImage + '\'; ');
    zoomwin.document.writeln('</script></head>');
    zoomwin.document.writeln('<body onload=\"toggle();\"><img id=\"z\" onclick=\"toggle()\"/>');
    zoomwin.document.writeln('</body></html>');
    zoomwin.moveTo(0,0);
    zoomwin.document.close();
    zoomwin.focus();
}

} // end object zoom

