function format_currency($val) {
    return '$' + $val;
}
(function(jQuery){
    jQuery.msg_modal_info = function(msg, title) {
        if (!title || title != 'undefined') {
            title = 'Message';
        }
        var html = jQuery.template('<div title="${title}"><div class="boxContainer">${msg}</div></div>').apply({msg: msg, title: title});
        jQuery(html).dialog(
            {
                bgiframe: true,
                modal: true,
                dialogClass: 'msgBox',
                overlay: {
                    backgroundColor: '#000',
                    opacity: 0.5
                },
                buttons: {
                    Ok: function() {
                        jQuery(this).dialog('close');
                    }
                }
            }
        );
    };
    jQuery.msg_modal_confirm = function(msg, on_ok, title, on_cancel) {
        if (!title || title != 'undefined') {
            title = 'Confirmation';
        }
        var html = jQuery.template('<div title="${title}" ><div class="boxContainer">${msg}</div></div>').apply({msg: msg, title: title});
        jQuery(html).dialog(
            {
                bgiframe: true,
                modal: true,
                dialogClass: 'msgBox',
                overlay: {
                    backgroundColor: '#000',
                    opacity: 0.5
                },
                buttons: {
                    Ok: function() {
                        jQuery(this).dialog('close');
                        if (jQuery.isFunction(on_ok)) {
                            on_ok();
                        }
                    },
                    Cancel: function() {
                        jQuery(this).dialog('close');
                        if (jQuery.isFunction(on_cancel)) {
                            on_cancel();
                        }
                    }
                }
            }
        );
    };
    jQuery.msg_info = function(msg, title, on_close) {
        if (!title || title != 'undefined') {
            title = 'Message';
        }
        var html = jQuery.template('<div title="${title}" ><div class="boxContainer">${msg}</div></div>').apply({msg: msg, title: title});
        
//        alert(on_close);
        jQuery(html).dialog(
            {
                dialogClass: 'msgBox',
                hide: 'fold',
                buttons: {
                    Ok: function() {
                        jQuery(this).dialog('close');
                        if (jQuery.isFunction(on_close)) {
                            on_close();
                        }
                    }
                }
            }
        );
    };
})(jQuery);

