in reply to Syntax errors galore, need a good debugging
The if that is causing the error is a new statement, so it needs to be preceeded by a semi-colon, or by the end of a block (closing curly).
Michael