/**
 * dialogControl
 * @author Kevin McBriarty
 * This is code that controls the jqModal jQuery plugin (http://dev.iceburg.net/jquery/jqModal/)
 * This class requires an HTML div that will be used as the container for the dialog.
 *
 * @param dialogDiv HTML div of the dialog
 *
 * @dependencies none
 *
 */
function DialogControl(dialogDiv) {

    this._cont = $(dialogDiv);
    this._cont.jqm({modal:true,trigger:false,toTop:true})

    this.showDialog = function() {
        this._objectEmbed(false);
        this._cont.jqmShow();
    };

    this.hideDialog = function(){
        this._cont.jqmHide();
        this._objectEmbed(true);
    };

    this._objectEmbed = function(show){
        if (show) {
            $("object:parent,embed:parent,object,embed").css({visibility:"visible"});
            DialogControl.count++;

        } else {
            DialogControl.count--;
            if (DialogControl.count <= 0) {
                $("object:parent,embed:parent,object,embed").css({visibility:"hidden"});
            }
        }
    };

}

DialogControl.count = 0;