Am I missing something, or should all the code after #sectionend interface_click // DO NOT EDIT OR REMOVE THIS LINE (if (interface == 3) { ..... } and if (interface == 4) { ..... } be in interface_click? As it is, it's not actually attached to any function, which may be why it's an 'unexpected if' error.