Ajax almost finished/needs to fix a bug with next/previous navigation (currently an infinite loop occurs?)