var modalMessages = new Array();

//message
function pd_modalMessage(ref, w, h, shadow, callback, args)
{
    this.ref_id = ref;
    this.args = args;
    ref = document.getElementById(ref);
    if (typeof(ref) != "object" || ref == null)
    {
        alert('pd_modalMessage: DOM reference is invalid');
        return;
    }
    this.msgObj = new DHTMLSuite.modalMessage();
    this.msgObj.setShadowOffset(5);
    this.msgObj.setSource(false);
    this.msgObj.setSize(w, h);
    this.msgObj.setShadowDivVisible(shadow);
    //this.msgObj.setHtmlContent(ref.innerHTML);
    //this.msgObj.setDomReference(ref);
    this.callback = callback;
    
    this.show = function() {
        if (this.callback != null)
        {
            if (this.args != null && typeof(this.args) == "object")
            {
	                    this.callback(this.ref_id, this.args);

            }
            else
            {
                this.callback(this.ref_id);
            }
        }
        this.msgObj.setHtmlContent(document.getElementById(this.ref_id).innerHTML);
        this.msgObj.display(); 
    };
    this.hide = function() {this.msgObj.close()};
    
    this.getDomRef = function()
    {
        return this.msgObj.divs_content;
    }
}



pd_modalMessage.prototype.create = function(ref, w, h, shadow, callback, args)
{
        if (typeof(modalMessages[ref]) != "undefined")
        {
            if (args && args['force'])
            {
                modalMessages[ref] = new pd_modalMessage(ref, w, h, shadow, callback, args);
            }
            return modalMessages[ref];
        }
        else
        {
            modalMessages[ref] = new pd_modalMessage(ref, w, h, shadow, callback, args);
            return modalMessages[ref];
        }
}


//tooltip
function pd_Tooltip()
{
    this.tooltipObj = new DHTMLSuite.dynamicTooltip();
}

pd_Tooltip.prototype.showStatic = function(elem, msg)
{
    this.tooltipObj.displayTooltip(false, elem, msg);
}

pd_Tooltip.prototype.hide = function()
{
    this.tooltipObj.hideTooltip();
}
