 +  $("div.gradient").append('<div id="RFIDStatus"><a class="btn btn-small" onclick="location.reload();">RFID</a><span id="RFIDStatusMessage"></span><button id="RFIDPreg" onclick="activateWrite(ws);">Preg brikker</button></div>');
 +  ws.onopen = function() {
 +    console.log("connected");
++    isConnected = true;
 +
 +    $('#RFIDStatus .btn').css("backgroundColor", "green");
 +

     <table id="checkedintable">
diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/rfidhub.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/rfidhub.inc
new file mode 100644
index 0000000..35d33bb
--- /dev/null
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/rfidhub.inc
@@ -0,0 +1,322 @@
+[% USE Koha %]
+<style type="text/css">
+/*

+  ws=new WebSocket(rfidhuburl);
+  window.onblur = function() {
+    windowInFocus = false;
+    clearTimeout(timer);
+    timer = setTimeout(function() {
+      if (isConnected && !windowInFocus) {
+        ws.close();
+      }
+    }, TIMEOUT);
+  }
+  branch = document.getElementById("logged-in-branch-code") ? document.getElementById("logged-in-branch-code").innerHTML : "ukjent";
+  state = $("body").attr("id");
