A person or corporation, whether as owner, lessee, agent or employee, who violates any of the provisions of this chapter or who fails to comply with any order or regulation made thereunder, or who erects, alters, moves or uses any building or uses any land in violation of any statements or plans submitted by him and approved under the provisions of this chapter, shall be guilty of an offense and upon conviction shall be punished by a fine not exceeding $350 or imprisonment not to exceed six months, or both, for a conviction of a first offense in accordance with the provisions of Article 16 of the Town Law, § 268, and amendments thereto, and any other article relating thereto. The penalty for a conviction of a second offense, both of which were committed within a period of five years, is punishable by a fine not less than $350 nor more than $700 or imprisonment for a period not to exceed six months, or both; and upon conviction for a third or subsequent offense, all of which were committed within a period of five years, punishable by a fine not less than $700 or more than $1,000 or imprisonment for a period not to exceed six months, or both. Each week's continued violation shall constitute a separate additional violation.