Added jquery cookie plugin, everything works now as it is supposed to