You error lays in your elseif lines. Your lines currently look like
I'm not sure why, but you seperated your elseif ith a {. Take the { out from in between so it they look like
I haven't tested to see if there's anything else wrong, but this is the only mistake I can see by looking at it.