﻿// Portal Window v2.0 - 7/19/07
// Details: Wrapper for implementing pop-up windows

//Portal Window Class
var PortalWindow = function() {
}
  
PortalWindow.prototype = {
    /* Public members */
    version: "2.0",
    defaultClassName: "alphacube",
    defaultDuration: 0.25, 
    className: "",
    title: "",
    showDuration: "",
    hideDuration: "",
    width: "",
    onOk: "",
    
    /* Public methods */
    // Alert method
    Alert : function(message, config) {
        this.className = (config && config.className) ? config.className : this.defaultClassName;
        this.title = (config && config.title) ? config.title : this.title;
        this.showDuration = (config && config.showDuration) ? config.showDuration : this.defaultDuration;
        this.hideDuration = (config && config.hideDuration) ? config.hideDuration : this.defaultDuration;
        this.width = (config && config.width) ? config.width : "";
        this.onOk = (config && config.onOk) ? config.onOk : "";            
        var onOkCallback = this.onOk;
        
        Dialog.alert(message, {windowParameters: {className: this.className, title: this.title, showEffectOptions: {duration: this.showDuration}, 
                                                    hideEffectOptions: {duration: this.hideDuration}, width: this.width, destroyOnClose: true},
                               onOk: function(){if(typeof onOkCallback == 'function') /* Add delay to allow prev win to close */ setTimeout(function(){try{onOkCallback();}catch(e){}}, 400); return true;} });
    }
}

