The Building and Safety Division has a lot of information on-line about this. There is even an on-line procedure for obtaining certain "single trade" permits and you can request an inspection time on-line! For all of this, see http://www.smgov.net/planning/buildingsafety/buildingandsafety.html