/// <reference path="QRCode.js" />
window.onload = Run;

function Run() {
    ShowQRCode();
};

function ShowQRCode() {
    try {
        var apkPath = GetApkPath();
        document.getElementById('qrcode').innerHTML = CreateQRCode(apkPath);
    } 
    catch (err) {
        // Do nothing, we just won't show the image.
    }
};

function GetApkPath() {
    var result = window.location.href;
    result = result.toLowerCase();
    result = result.replace("default.aspx", "");
    result = result + "inspHire.Mobile.apk";
    return result;
};

function CreateQRCode(text, typeNumber, errorCorrectLevel, table) {
    var qr = qrcode(typeNumber || 4, errorCorrectLevel || 'M');
    qr.addData(text);
    qr.make();

    return qr.createImgTag(4);
};

