var data;
var laststate;

window.setInterval(function(){
	$.getJSON("/api/simple/v2", function(data){ 
		var html = [];

		$.each(data, function(index, value){
			if (index == 'state' && value == false && laststate != false) {
				laststate = false;
				showNotification("CTDO - Status", "Der Chaostreff Dortmund ist nun geschlossen.", "/img/red.png", 4);
			}   
			else if (index == 'state' && value == true && laststate != true) {
				laststate = true;
				showNotification("CTDO - Status", "Der Chaostreff Dortmund ist nun offen.", "/img/green.png", 4);
			}else {
			// Nothing
			}
		});
	});
}, 60000);
