 +  ws.onclose = function() {
 +    console.log("disconnected");
 +    $('#RFIDStatus .btn').css("backgroundColor", "orange");
-+    if (windowInFocus) {
++    if (windowInFocus && wasOnceConnected) {
 +      connect();
 +    }
 +  }

+  state = $("body").attr("id");
+  // activate RFID Modal
+  $("#RFIDStatus").remove(); // In case this is a reconnect
+  $("div.gradient").append('<div id="RFIDStatus"><a href="#" class="btn btn-small">RFID</a><span id="RFIDStatusMessage"></span><button id="RFIDPreg" onclick="activateWrite(ws);">Preg brikker</button></div>');
+  ws.onopen = function() {
+    console.log("connected");
+    $('#RFIDStatus .btn').css("backgroundColor", "green");
+
+    ws.onmessage = function(resp) {

+            $('#RFIDStatusMessage').text("Disconnected from RFIDHub, please refresh Browser to try to reconnect!");
+            break;
+          case "CHECKIN":
+            wasOnceConnected = true;
+            console.log(" <- "+resp.data);
+            handleItem(data);
+            break;
+          case "CHECKOUT":
+            wasOnceConnected = true;
+            console.log(" <- "+resp.data);
+            handleItem(data);
+            break;
+          case "ITEM-INFO":
+            wasOnceConnected = true;
+            console.log(" <- "+resp.data);
+            if (data.Item.Unknown) { // Failed to Look up Item
+              $('#itemStatusDiv').toggleClass('hidden', false);
