if (typeof Structura == "undefined") {
    var Structura = {};
}

if (typeof Structura.ImagePanel == "undefined") {
    Structura.ImagePanel = function(){
        var sUrl =
            window.location.protocol + 
            "//" + 
            window.location.hostname + 
            (window.location.port == "" ? "" : ":" + window.location.port) +
            window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/")) +
            "/GeneratePicture.aspx";
        
        Structura.ImagePanel.PositionPanel = function()
        {
            var x = YAHOO.util.Dom.getX('ctl00_ContentPlaceHolder1_pnlOpacity') + 8;
            var y = YAHOO.util.Dom.getY('ctl00_ContentPlaceHolder1_pnlOpacity');
            Structura.ImagePanel.Panel.moveTo(x, y);
        }
        
        Structura.ImagePanel.InitializePanel = function(){
            Structura.ImagePanel.Panel = 
                new YAHOO.widget.Panel("detailsImagePanel", 
                    {
                        x: 20,
                        y: 20,
                        draggable: true,
                        underlay: "none",
                        visible:false, 
                        fixedcenter:false, 
                        modal: false,
                        close: false,
                        constraintoviewport: false, 
                        effect:[{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.35}],
                        zIndex: 10001
                    } 
                );
            Structura.ImagePanel.Panel.render();
            
            try
            {
                Structura.EstateDetail.Panel.beforeHideEvent.subscribe(Structura.ImagePanel.HidePanel);
            }
            catch(exception)
            {
            }
        }
        
        Structura.ImagePanel.ShowPanel = function(imageName){
            Structura.ImagePanel.Panel.setHeader('');
            Structura.ImagePanel.Panel.setBody('<img title="click to close" style="cursor: pointer;" src="' + sUrl + "?Name=" + imageName + '" ' + 'onclick="Structura.ImagePanel.HidePanel()"' + '>');
            Structura.ImagePanel.Panel.innerElement.style.display = '';
            Structura.ImagePanel.Panel.show();
        }
        
        Structura.ImagePanel.HidePanel = function(){
            if(Structura.ImagePanel.Panel != null)
            {
                Structura.ImagePanel.Panel.hide();
            }
        }
    }
}

Structura.ImagePanel();
YAHOO.util.Event.addListener(window, "load", Structura.ImagePanel.InitializePanel);