js to switch layout now works