Looks like a missing "endif" before the cookie1 could be your problem.