
// create the window on the first click and reuse on subsequent clicks
var win;

function showImageViewer(htmlText, width, height){
    showPopWindow('Picture Viewer', htmlText, width, height);
}

function showPopWindow(windowTitle, htmlText, width, height){
    
    if(!win){
        win = new Ext.Window({
            html:htmlText,
            title:windowTitle,
            width:width,
            height:height,
            closeAction:'hide',
            bodyStyle:'background:white; padding: 10px;',
            progress:true,
            modal:true,
            resizable:false
        });
    }

win.show();    
}

function showPageViewer(pageTitle, url, width, height){
    
    var htmlText = '<iframe width="'+ width +'" height="'+ height 
                    +'" frameborder="0" src="'+ url +'"></iframe>';
    
    showPopWindow(pageTitle, htmlText, width, height);
}

function closeWindow(){
    win.hide();
    return false;
}