 if (CmdUtils.parserVersion == 2) {
   //parser 2 command
CmdUtils.CreateCommand({
      names: ['qrcode'],
      description: 'Generate QR Codes',
      homepage: 'http://www.kornnuts.com/dev/barcode/qrcode.php',
      author: {name: 'Paul Picazo', email: 'not@yet.com'},
      license: 'GPL',
      arguments: [{role: 'object', nountype: noun_arb_text, label: 'url or text to qrencode'}],

      preview: function( pblock, args ) {
        pblock.innerHTML = "QRcode Image loading...";

        if (args.object.text == "") {
            pblock.innerHTML = "Contents: " + CmdUtils.getDocument().location +
              "<a href=\"\http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=" + CmdUtils.getDocument().location + "\">" +
                "<img style=\"width: 350px; height: 350px;\" border=50 src='http://www.kornnuts.com/dev/barcode/php_qrcode/QRcode_image.php?u=1&z=6&ecl=M&s=" +  CmdUtils.getDocument().location + "'>"
                + "</a>";
        }
        else {
            pblock.innerHTML = "Contents: " + args.object.text + "<a href=\"\http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=" + args.object.text + "\">" +
            "<img style=\"width: 350px; height: 350px;\" border=40 src='http://www.kornnuts.com/dev/barcode/php_qrcode/QRcode_image.php?u=1&z=6&ecl=M&s=" + args.object.text + "'>"
            + "</a>";
         }
      },
      execute: function(args) {

        if (args.object.text == "") {
          qrcode_page_url='http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=' + CmdUtils.getDocument().location;
        }
        else {
            qrcode_page_url='http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=' + args.object.text;
        }

        Utils.openUrlInBrowser(qrcode_page_url);

      }
});

 } else {
   //parser 1 command
CmdUtils.CreateCommand({
      name: "qrcode",
      description: 'Generate QR Codes',
      homepage: 'http://www.kornnuts.com/dev/barcode/qrcode.php',
      author: {name: 'Paul Picazo', email: 'not@yet.com'},
      license: 'GPL',
      takes: {"url or text to qrencode": noun_arb_text},

      preview: function( pblock, text ) {
        pblock.innerHTML = "QRcode Image loading...";
    
        if (text.text == "") {
            pblock.innerHTML = "Contents: " + CmdUtils.getDocument().location +
              "<a href=\"\http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=" + CmdUtils.getDocument().location + "\">" +
                "<img style=\"width: 350px; height: 350px;\" border=50 src='http://www.kornnuts.com/dev/barcode/php_qrcode/QRcode_image.php?u=1&z=6&ecl=M&s=" +  CmdUtils.getDocument().location + "'>"
                + "</a>";
        }
        else {
            pblock.innerHTML = "Contents: " + text.text + "<a href=\"\http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=" + text.text + "\">" +
            "<img style=\"width: 350px; height: 350px;\" border=40 src='http://www.kornnuts.com/dev/barcode/php_qrcode/QRcode_image.php?u=1&z=6&ecl=M&s=" +  text.text + "'>"
            + "</a>";
         }
      },
      execute: function(text) {

        if (text.text == "") {
          qrcode_page_url='http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=' + CmdUtils.getDocument().location;
        }
        else {
            qrcode_page_url='http://www.kornnuts.com/dev/barcode/qrcode.php?u=1&ecl=M&text=' + text.text;
        }
        
        Utils.openUrlInBrowser(qrcode_page_url);

      }
});
}
