switch(dialogid){ case DIALOG_REGISTER: { // Script here... } case DIALOG_LOGIN: { // Script here } case 1: // This is the same as if(dialogid == 1) { // Script here }}