;

function setupWebViewJavascriptBridge(callback) {
    if (window.WebViewJavascriptBridge) {
        return callback(WebViewJavascriptBridge);
    } else {
        document.addEventListener("WebViewJavascriptBridgeReady", function() {
            return callback(WebViewJavascriptBridge);
        }, false);
    }
    if (window.WVJBCallbacks) {
        return window.WVJBCallbacks.push(callback);
    }
    window.WVJBCallbacks = [callback];
    var wvjbIframe = document.createElement("iframe");
    wvjbIframe.style.display = "none";
    wvjbIframe.src = "wvjbscheme://__BRIDGE_LOADED__";
    document.documentElement.appendChild(wvjbIframe);
    setTimeout(function() { document.documentElement.removeChild(wvjbIframe) }, 0);
}

setupWebViewJavascriptBridge(function(bridge) {
    
    $("[data-invoke]").click(function(e) {
        e.preventDefault();
        var parms;
        if (typeof ($(this).attr("data-parms")) == "undefined") {
            parms = {};
        } else {
            parms = $(this).attr("data-parms");
        }
        bridge.callHandler("QbJsBridge_" + $(this).attr("data-invoke"), parms, function(response) {
        });
    });
});