At loading of your page, you call setInterval.
So, every two seconds, you will call the popup function, which says 'hallo'.
Then, you increment your variable, etc...
=> To get your c
variable incremented, increment it in the popup function.
EDIT: To answer the comment with a better layout:
setInterval() returns an interval ID, which you can pass to clearInterval():
var refreshIntervalId = setInterval(fname, 10000);
/* later */
clearInterval(refreshIntervalId);