index: cleanup
added some more messages to js
added proper cookies and moved all to functions.php

functions.php should be called from now on
Keep in mind this cookie thing is not properly tested yet.