Added SIP arrange UI restrictions and JS cleanup.

Added logic to disable action buttons in the SIP arrange
panel when conditions for the action are unsuitable.
Commented and cleaned up JavaScript.