var lbWindowLib = true;
var contentWin=null;

//f-ajax file; w-window width; ttl - window title
function e107Window(f,s,w,h,ttl){               
    if (contentWin != null) {
        e107alert('','There is already opened window. Close it first and try again.',200);
    } else {
        if(!w) w=350;
        if(!h) h=400;
        contentWin = new Window('e107_win',
                                {className: 'lightbox', resizable: true,
                                    hideEffect:Effect.Fade, showEffect:Effect.Appear, minWidth: w, minHeight: h, zIndex: 6000,
                                    wiredDrag: true, title: ttl,
                                    closeCallback: function() { contentWin = null; return true; }
                                });
        if(!s && f) {
            contentWin.setAjaxContent(f, {method: 'get'});
        } else {
            contentWin.getContent().update(s);
        }
        contentWin.setDestroyOnClose();
        contentWin.showCenter();
    }
}

function e107confirm(f,s,w){              
    if(!s && f) {
        var fcont = {url: f, options: {method: 'get'}};
    } else {
        var fcont = s;
    }
    Dialog.confirm(fcont,
        {   windowParameters: {className: 'lightbox', width:w},
            okLabel: 'Ok', cancelLabel: 'Cancel',
            ok: function() {return true;}, cancel: function() {return false;},
            zIndex: 6000
          
        });
}

function e107alert(f,s,w){
    if(!s && f) {
        var fcont = {url: f, options: {method: 'get'}};
    } else {
        var fcont = s;
    }        
    Dialog.alert(fcont,
        {windowParameters: {className: 'lightbox', width:w},
            okLabel: 'Ok',
            ok: function() {return true;},
            zIndex: 6000
           
        });
}
