1. Gamemaker uses GML, not Javascript. 2. Open "rm_main_menu". In the Inspector, click on "Instance Creation Order". Make sure "obj_menu_background" is above "obj_main_menu_ui" on the list.
The number of columns in the palette is the number of recolors/skins you can use in-game. The number of rows is how many colors are in the original sprite.